<template>
  <div class="console-page">
    <el-container>
      <el-aside width="100px" height="100%">
        <div class="logo">
          <img src="../../assets/img/CatWorkLogo.png" alt="" width="100%" height="100%" style="cursor: pointer" @click="toConsole">
          <span style="color: white">{{EnterpriseName}}</span>
        </div>
        <div class="menu">
          <el-menu class="el-menu-vertical-demo" :collapse="isCollapse" style="border: 0">
            <router-link to="/user/main">
              <el-menu-item index="1" class="menuIcon">
                <i class="el-icon-s-home"></i>
                <span slot="title">主页</span>
              </el-menu-item>
            </router-link>
            <router-link to="/user/projects/myMission/directed">
            <el-menu-item index="2" class="menuIcon menu-padding" >
                <i class="el-icon-s-order"></i>
                <span slot="title">项目管理</span>
            </el-menu-item>
            </router-link>
            <el-popover
                    placement="right"
                    width="100"
                    trigger="click">
              <div class="addMenu" @click="openAddProjectsDialog">
              <span>
                <i class="el-icon-s-order" style="color:pink"></i>
                项目
              </span>
                <hr>
              </div>
              <div class="addMenu" @click="openAddMissionDialog(0)">
              <span>
                <i class="el-icon-document" style="color: greenyellow"></i>
                任务
              </span>
                <hr>
              </div>
              <div class="addMenu" @click="openAddExamineDialog">
              <span>
                <i class="el-icon-s-check" style="color: cornflowerblue"></i>
                审批
              </span>
                <hr>
              </div>
              <div class="addMenu" @click="openAddWorkTimeDialog">
            <span>
              <i class="el-icon-timer" style="color: lightskyblue"></i>
              工时
            </span>
              </div>
              <el-menu-item index="3" class="menuIcon menu-padding" slot="reference">
                <i class="el-icon-plus"></i>
                <span slot="title">新建</span>
              </el-menu-item>
            </el-popover>
            <router-link to="/user/examine/apply">
              <el-menu-item index="4" class="menuIcon menu-padding" >
                <i class="el-icon-s-check"></i>
                <span slot="title">审批</span>
              </el-menu-item>
            </router-link>
            <el-menu-item index="5" class="menuIcon menu-padding" @click="openMessageDialog">
              <el-badge :value="messageNumber" :max="99" :hidden="messageNumber == 0">
                <i class="el-icon-chat-dot-round"></i>
              </el-badge>
              <span slot="title">消息</span>
            </el-menu-item>
          </el-menu>
          <div style="text-align: center">
            <el-tooltip effect="dark" content="账号设置" placement="right">
              <el-avatar @click.native ="drawer = true" class="headPortrait" :src="headImageUrl"></el-avatar>
            </el-tooltip>
          </div>
        </div>
      </el-aside>
      <el-container>
        <router-view @openExamine = "openExamineDialog" @openAddMissionDialog = "openAddMissionDialog(0)"
                     @openMission="openMissionDialog" @addProject="openAddProjectsDialog"></router-view>
      </el-container>
    </el-container>
    <!-- 创建项目窗口 -->
    <el-dialog
            title="创建项目"
            :visible.sync="AddProjectsDialog"
            width="500px"
            center>
      <el-form :model="addProjectsForm" :rules="rules" ref="addProjectsForm" label-width="80px">
        <el-form-item label="项目名称" prop="name">
          <el-input v-model.trim="addProjectsForm.name" placeholder="项目名称"></el-input>
        </el-form-item>
        <el-form-item label="项目编号" prop="number">
          <el-input v-model.trim ="addProjectsForm.number" placeholder="项目编号"></el-input>
        </el-form-item>
        <el-form-item label="可见范围" prop="scopeValue">
          <el-select v-model="addProjectsForm.scopeValue" placeholder="请选择" style="width: 100%">
            <el-option
                    v-for="item in scope"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="描述"  prop="projectsContent">
          <el-input
                  type="textarea"
                  autosize
                  placeholder="给项目写点描述"
                  v-model="addProjectsForm.projectsContent">
          </el-input>
        </el-form-item>
        <el-form-item label="成员" prop="projectsMembers">
          <el-select v-model="addProjectsForm.projectsMembers" multiple filterable placeholder="请选择" style="width: 100%">
            <el-option
                    v-for="item in members"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value">
              <el-avatar style="float:left; margin-top:3px;" size="small" :src="item.circleUrl"></el-avatar>
              <span style="float:left;margin-left: 5px;">{{ item.label }}</span>
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click.native="addProject('addProjectsForm')">确定</el-button>
          <el-button @click="AddProjectsDialog = false">取消</el-button>
        </el-form-item>
      </el-form>
    </el-dialog>

    <!-- 创建任务窗口 -->
    <el-dialog
            title="创建任务"
            :visible.sync="AddMissionDialog"
            width="700px"
            center>
      <el-form :model="addMissionForm"  :rules="addMissionFormRules" ref="addMissionForm" label-width="80px">
        <el-form-item label="标题" prop="title">
          <el-input v-model.trim="addMissionForm.title" placeholder="请输入标题"></el-input>
        </el-form-item>
        <el-row>
          <el-col :span="12">
            <el-form-item label="选择项目" prop="projectValue">
              <el-select class="selectStyle" v-model="addMissionForm.projectValue" filterable placeholder="请选择项目"
                         @visible-change = "getProjects($event)">
                <el-option
                        v-for="item in projects"
                        :key="item.id"
                        :label="item.name"
                        :value="item.id">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="类型" prop="missionType">
              <el-select class="selectStyle" v-model="addMissionForm.missionType" placeholder="请选择任务类型">
                <el-option
                        v-for="item in type"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12" v-if="addMissionForm.missionType != 0">
            <el-form-item label="负责人" prop="missionPrincipalValue">
              <el-select class="selectStyle" v-model="addMissionForm.missionPrincipalValue" filterable placeholder="请选择负责人">
                <el-option
                        v-for="item in members"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value">
                  <el-avatar style="float:left; margin-top:3px;" size="small" :src="item.circleUrl"></el-avatar>
                  <span style="float:left;margin-left: 5px;">{{ item.label }}</span>
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12" v-if="addMissionForm.missionType == 2">
            <el-form-item label="开始时间" prop="missionStart">
              <div class="block">
                <el-date-picker
                        v-model="addMissionForm.missionStart"
                        type="datetime"
                        placeholder="选择日期时间"
                        align="right"
                        value-format="yyyy-MM-dd HH:mm:ss"
                        :picker-options="pickerOptions"
                        style="width: 100%">
                </el-date-picker>
              </div>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24" v-if="addMissionForm.missionType == 1">
            <el-form-item label="财务人员" prop="financialStaffs">
              <el-select class="selectStyle" v-model="addMissionForm.financialStaffs" multiple filterable placeholder="请选择财务人员">
                <el-option
                        v-for="item in members"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value">
                  <el-avatar style="float:left; margin-top:3px;" size="small" :src="item.circleUrl"></el-avatar>
                  <span style="float:left;margin-left: 5px;">{{ item.label }}</span>
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row v-if="addMissionForm.missionType == 1">
          <el-col :span="12">
            <el-form-item label="财务科目" prop="finance">
              <el-select class="selectStyle" v-model="addMissionForm.finance" filterable placeholder="请选择数据项">
                <el-option
                        v-for="item in finances"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="预算金额" prop="budget">
              <el-input-number size="medium" v-model.trim="addMissionForm.budget"></el-input-number>&nbsp;元
            </el-form-item>
          </el-col>
        </el-row>
        <el-row v-if="addMissionForm.missionType == 1">
          <el-col :span="12">
            <el-form-item label="执行金额" prop="performAccount">
              <el-input-number size="medium" v-model="addMissionForm.performAccount"></el-input-number>&nbsp;元
            </el-form-item>
          </el-col>
        </el-row>
        <el-row v-if="addMissionForm.missionType == 2">
          <el-col :span="12">
            <el-form-item label="截止时间" prop="missionOver">
              <div class="block">
                <el-date-picker
                        v-model="addMissionForm.missionOver"
                        type="datetime"
                        placeholder="选择日期时间"
                        value-format="yyyy-MM-dd HH:mm:ss"
                        align="right"
                        :picker-options="pickerOptions"
                        style="width: 100%">
                </el-date-picker>
              </div>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="项目阶段" prop="projectProcess">
              <el-select v-model="addMissionForm.projectProcess" filterable placeholder="请选择数据项" class="selectStyle">
                <el-option
                        v-for="item in projectProcessArray"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row v-if="addMissionForm.missionType != 1">
          <el-col :span="12">
            <el-form-item label="优先级"  prop="priority">
              <el-select v-model="addMissionForm.priority" filterable placeholder="请选择数据项" class="selectStyle">
                <el-option
                        v-for="item in priorityArray"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row v-if="addMissionForm.missionType == 2">
          <el-col :span="24">
            <el-form-item label="参与人" prop="missionMember">
              <el-select v-model="addMissionForm.missionMember" multiple filterable placeholder="请选择成员" class="selectStyle" >
                <el-option
                        v-for="item in members"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value">
                  <el-avatar style="float:left; margin-top:3px;" size="small" :src="item.circleUrl"></el-avatar>
                  <span style="float:left;margin-left: 5px;">{{ item.label }}</span>
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="描述" prop="missionContent">
              <el-input
                      type="textarea"
                      autosize
                      placeholder="请输入内容"
                      v-model="addMissionForm.missionContent">
              </el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-form-item>
          <el-button type="primary" @click.native="addMission('addMissionForm')">确定</el-button>
          <el-button @click="AddMissionDialog = false">取消</el-button>
        </el-form-item>
      </el-form>
    </el-dialog>

    <!-- 申请审批窗口 -->
    <el-dialog
            title="申请审批"
            :visible.sync="AddExamineDialog"
            width="500px"
            center>
      <el-form ref="addExamineForm" :model="addExamineForm" label-width="80px" :rules="addExamineFormRules">
        <el-form-item label="申请内容" prop="content">
          <el-input v-model="addExamineForm.content" placeholder="申请内容(必填)"></el-input>
        </el-form-item>
        <el-form-item label="审批详情" prop="examineContent">
          <el-input
                  type="textarea"
                  autosize
                  placeholder="审批详情"
                  v-model="addExamineForm.examineContent">
          </el-input>
        </el-form-item>
        <el-form-item label="审批人" prop="examinePeople">
          <el-select v-model="addExamineForm.examinePeople" multiple filterable placeholder="请选择成员（选择顺序为审批顺序）" class="selectStyle">
            <el-option
                    v-for="item in members"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value">
              <el-avatar style="float:left; margin-top:3px;" size="small" :src="item.circleUrl"></el-avatar>
              <span style="float:left;margin-left: 5px;">{{ item.label }}</span>
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click.native="addExamine('addExamineForm')">提交</el-button>
          <el-button @click="AddExamineDialog = false">取消</el-button>
        </el-form-item>
      </el-form>
    </el-dialog>

    <el-dialog
      title="上传审批文件"
      :visible.sync="AddExamineFileDialog"
      width="500px"
      :close-on-click-modal = "false"
      center>
      <el-upload
        class="avatar-uploader"
        action="#"
        :show-file-list="false"
        :http-request="addExmaineFile"
        multiple>
        <el-button slot="trigger" size="small" type="primary">选取文件</el-button>
      </el-upload>
    </el-dialog>

    <!-- 登记工时窗口 -->
    <el-dialog
            title="登记工时"
            :visible.sync="AddWorkTimeDialog"
            width="700px"
            center>
      <el-form ref="workTimeForm" :rules="workTimeFormRules" :model="workTimeForm" label-width="80px">
        <el-form-item label="任务" prop="missionValue">
          <el-select class="selectStyle" v-model="workTimeForm.missionValue" filterable placeholder="选择登记任务">
            <el-option
                    v-for="item in missions"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="工作日期" prop="workDate">
          <div class="block">
            <el-date-picker
              v-model="workTimeForm.workDate"
              type="date"
              placeholder="选择日期"
              value-format="yyyy-MM-dd">
            </el-date-picker>
          </div>
        </el-form-item>
        <el-row>
          <el-col :span="12">
            <el-form-item label="工作时长" prop="workTime">
              <el-input-number size="small" v-model="workTimeForm.workTime" :min="0"></el-input-number>&nbsp;小时
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="工时类别" prop="workType">
              <el-select class="selectStyle" v-model="workTimeForm.workType" filterable placeholder="请选择工时类别">
                <el-option
                        v-for="item in workTypes"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-form-item label="工时描述" prop="workContent">
          <el-input
                  type="textarea"
                  autosize
                  placeholder="输入工时描述"
                  v-model="workTimeForm.workContent">
          </el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click.native="addWorkTime('workTimeForm')">登记</el-button>
          <el-button @click="AddWorkTimeDialog = false">取消</el-button>
        </el-form-item>
      </el-form>
    </el-dialog>

    <!-- 选择子任务窗口 -->
    <el-dialog
      title="选择子任务"
      :visible.sync="AddSonMissionDialog"
      width="700px"
      center>
      <div style="height: 600px;overflow: auto;border-top:2px solid #3a8ee6;padding-top:20px;">
        <el-table
          ref="multipleTable"
          :data="addSonMissions"
          tooltip-effect="dark"
          style="width: 100%"
          @selection-change="addSonMissionSelect">
          <el-table-column
            type="selection"
            width="55">
          </el-table-column>
          <el-table-column
            prop="id"
            label="编号"
            width="120">
          </el-table-column>
          <el-table-column
            prop="status"
            label="状态"
            width="120">
          </el-table-column>
          <el-table-column
            prop="missionName"
            label="名称"
            show-overflow-tooltip>
          </el-table-column>
        </el-table>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="AddSonMissionDialog = false">取 消</el-button>
        <el-button type="primary" @click="updateSonMission">确 定</el-button>
      </span>
    </el-dialog>

    <!-- 选择关联任务窗口 -->
    <el-dialog
      title="选择关联任务"
      :visible.sync="AddRelMissionDialog"
      width="700px"
      center>
      <div style="height: 600px;overflow: auto;border-top:2px solid #3a8ee6;padding-top:20px;">
        <el-table
          ref="multipleTable"
          :data="addRelMissions"
          tooltip-effect="dark"
          style="width: 100%"
          @selection-change="addRelMissionSelect">
          <el-table-column
            type="selection"
            width="55">
          </el-table-column>
          <el-table-column
            prop="id"
            label="编号"
            width="120">
          </el-table-column>
          <el-table-column
            prop="status"
            label="状态"
            width="120">
          </el-table-column>
          <el-table-column
            prop="missionName"
            label="名称"
            show-overflow-tooltip>
          </el-table-column>
        </el-table>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="AddRelMissionDialog = false">取 消</el-button>
        <el-button type="primary" @click="updateRelMission">确 定</el-button>
      </span>
    </el-dialog>

    <!-- 选择前置任务窗口 -->
    <el-dialog
      title="选择前置任务"
      :visible.sync="AddBeforeMissionDialog"
      width="700px"
      center>
      <div style="height: 600px;overflow: auto;border-top:2px solid #3a8ee6;padding-top:20px;">
        <el-table
          ref="multipleTable"
          :data="addBeforeMissions"
          tooltip-effect="dark"
          style="width: 100%"
          @selection-change="addBeforeMissionSelect">
          <el-table-column
            type="selection"
            width="55">
          </el-table-column>
          <el-table-column
            prop="id"
            label="编号"
            width="120">
          </el-table-column>
          <el-table-column
            prop="status"
            label="状态"
            width="120">
          </el-table-column>
          <el-table-column
            prop="missionName"
            label="名称"
            show-overflow-tooltip>
          </el-table-column>
        </el-table>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="AddBeforeMissionDialog = false">取 消</el-button>
        <el-button type="primary" @click="updateBeforeMission">确 定</el-button>
      </span>
    </el-dialog>

    <!-- 选择后置任务窗口 -->
    <el-dialog
      title="选择后置任务"
      :visible.sync="AddAfterMissionDialog"
      width="700px"
      center>
      <div style="height: 600px;overflow: auto;border-top:2px solid #3a8ee6;padding-top:20px;">
        <el-table
          ref="multipleTable"
          :data="addAfterMissions"
          tooltip-effect="dark"
          style="width: 100%"
          @selection-change="addAfterMissionSelect">
          <el-table-column
            type="selection"
            width="55">
          </el-table-column>
          <el-table-column
            prop="id"
            label="编号"
            width="120">
          </el-table-column>
          <el-table-column
            prop="status"
            label="状态"
            width="120">
          </el-table-column>
          <el-table-column
            prop="missionName"
            label="名称"
            show-overflow-tooltip>
          </el-table-column>
        </el-table>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="AddAfterMissionDialog = false">取 消</el-button>
        <el-button type="primary" @click="updateAfterMission">确 定</el-button>
      </span>
    </el-dialog>

    <!-- 任务详情窗口 -->
    <el-dialog
       :visible.sync="MissionDialog"
       width="900px"
       :close-on-click-modal = "false"
       @close="replyCommentId = 0; MissionComment = '';comment_open = 0;"
    >
      <div slot="title" class="clearfix">
        <el-tooltip class="item" effect="dark" content="点击复制" placement="bottom">
          <span class="missionDialogTitle" :data-clipboard-text="'#'+missionsDetail.number" @click="copy">{{missionsDetail.number}}</span>
        </el-tooltip>
        <el-button type="danger" style="float: right;margin-right: 20px" size="small" icon="el-icon-delete" v-if="MissionIsUpdate" @click="deleteMission"></el-button>
      </div>
      <div style="height: 600px;overflow: auto;border-top:2px solid #3a8ee6;padding-top:20px;">
        <div>
            <span style="font-size: 24px;display: block;word-wrap: break-word; cursor: pointer" @click="openMissionTitle" v-show="title_open == 0">{{missionsDetail.name}}</span>
            <el-input type="text" v-model.trim="missionsDetail.name" style="width: 90%" v-show="title_open == 1" ref="title" @blur="updateMissionTitle">
            </el-input>
        </div>
        <div class="clearfix">
          <div style="float: left;width: 25%;">
            <p>当前状态</p>
            <p  slot="reference"v-show="status_open == 0"><span style="cursor: pointer" @click="openMissionStatus" >{{missionsDetail.state}}</span></p>
            <el-select v-model="missionsDetail.state" placeholder="请选择" v-show="status_open == 1" size="small"
                       @blur="status_open = 0" @change="updateMissionStatus" ref="missionStatus" style="width: 40%">
              <el-option
                v-if="missionsDetail.type == '项目任务'"
                v-for="item in missionStatus"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              ></el-option>
              <el-option
                v-if="missionsDetail.type == '项目目标'"
                v-for="item in TargetStatus"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              ></el-option>
              <el-option
                v-if="missionsDetail.type == '项目费用'"
                v-for="item in CostStatus"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              ></el-option>
            </el-select>
          </div>
          <div style="float: left;width: 25%;">
            <p>负责人</p>
            <el-avatar style="float:left;margin-top: -5px" size="small" :src="missionsDetail.circleUrl" v-show="principal_open == 0" v-if="missionsDetail.circleUrl != '' "></el-avatar>
            <p slot="reference"v-show="principal_open == 0"><span style="cursor: pointer" @click="openPrincipal" >{{missionsDetail.principal}}</span></p>
            <el-select v-model="missionsDetail.principal" filterable placeholder="请选择" v-show="principal_open == 1" size="small"
                       @blur="principal_open = 0" @change="updateMissionPrincipal($event)" ref="principal" style="width: 40%">
              <el-option
                v-for="item in members"
                :key="item.value"
                :label="item.label"
                :value="item.value">
                <el-avatar style="float:left; margin-top:3px;" size="small" :src="item.circleUrl"></el-avatar>
                <span style="float:left">{{ item.label }}</span>
              </el-option>
            </el-select>
          </div>
          <div style="float: left;width: 25%;">
            <p>开始日期</p>
            <p  slot="reference"v-show="start_open == 0"><span style="cursor: pointer" @click="openStart" v-if="missionsDetail.start != ''">{{missionsDetail.start}}</span></p>
            <p  slot="reference"v-show="start_open == 0"><span style="cursor: pointer" @click="openStart" v-if="missionsDetail.start == ''">无</span></p>
            <el-date-picker
              v-model="missionsDetail.start"
              type="datetime"
              placeholder="选择日期时间"
              align="right"
              size="small"
              :editable="false"
              format="yyyy-MM-dd HH:mm:ss"
              value-format="yyyy-MM-dd HH:mm:ss"
              :picker-options="pickerOptions"
              v-show="start_open == 1"
              @blur="start_open = 0"
              @change="updateMissionStart"
              ref="start"
              style="width: 90%">
            </el-date-picker>
          </div>
          <div style="float: left;width: 25%;">
            <p>截止日期</p>
            <p  slot="reference"v-show="over_open == 0"><span style="cursor: pointer" @click="openOver" v-if="missionsDetail.over != ''">{{missionsDetail.over}}</span></p>
            <p  slot="reference"v-show="over_open == 0"><span style="cursor: pointer" @click="openOver" v-if="missionsDetail.over == ''">无</span></p>
            <el-date-picker
              v-model="missionsDetail.over"
              type="datetime"
              placeholder="选择日期时间"
              align="right"
              size="small"
              :editable="false"
              format="yyyy-MM-dd HH:mm:ss"
              value-format="yyyy-MM-dd HH:mm:ss"
              :picker-options="pickerOptions"
              v-show="over_open == 1"
              @blur="over_open = 0"
              @change="updateMissionOver"
              ref="over"
              style="width: 90%">
            </el-date-picker>
          </div>
        </div>
        <el-tabs v-model="activeName" @tab-click="MissionTab">
          <el-tab-pane name="first" class="clearfix"><span slot="label"><i class="el-icon-s-operation"></i> 任务信息</span>
            <div style="float: left;width: 33%">
              <p>项目名称：</p>
              <p  slot="reference"><span style="cursor: pointer">{{missionsDetail.projectName}}</span></p>
            </div>
            <div style="float: left;width: 33%">
              <p>项目类型：</p>
              <p>{{missionsDetail.type}}</p>
            </div>
            <div style="float: left;width: 33%" v-if="missionsDetail.type == '项目任务'">
              <p>项目阶段：</p>
              <p  slot="reference"v-show="stage_open == 0"><span style="cursor: pointer" @click="openStage">{{missionsDetail.stage}}</span></p>
              <el-select v-model="missionsDetail.stage" placeholder="请选择" v-show="stage_open == 1" size="small"
                         @blur="stage_open = 0" @change="updateMissionPhase" ref="stage" style="width: 40%;margin-bottom: 1px;">
                <el-option
                  v-for="item in projectProcessArray"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                >
                </el-option>
              </el-select>
            </div>
            <div style="float: left;width: 33%" v-if="missionsDetail.type != '项目费用'">
              <p>优先级：</p>
              <p  slot="reference"v-show="priority_open == 0"><span style="cursor: pointer" @click="openPriority">{{missionsDetail.priority}}</span></p>
              <el-select v-model="missionsDetail.priority" placeholder="请选择" v-show="priority_open == 1" size="small"
                         @blur="priority_open = 0" @change="updateMissionPriority" ref="priority" style="width: 30%;margin-bottom:1px;">
                <el-option
                  v-for="item in priorityArray"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                >
                </el-option>
              </el-select>
            </div>
            <div style="float: left;width: 33%" v-if="missionsDetail.type == '项目目标'">
              <p>量化指标-单位：</p>
              <p style="cursor: pointer"  @click="openUnit" v-show="unit_open == 0" v-if="missionsDetail.unit != ''">{{missionsDetail.unit}}</p>
              <p style="cursor: pointer"  @click="openUnit" v-show="unit_open == 0" v-if="missionsDetail.unit == ''">无</p>
              <el-input type="text" v-model.trim="missionsDetail.unit" style="width: 90%" v-show="unit_open == 1" ref="unit" @blur="updateTargetUnit" size="small">
              </el-input>
            </div>
            <div style="float: left;width: 33%" v-if="missionsDetail.type == '项目目标'">
              <p>量化指标-起始值：</p>
              <p style="cursor: pointer;font-size: 15px" v-show="initial_open == 0" @click="openInitial" v-if="missionsDetail.initial != ''">{{missionsDetail.initial}}</p>
              <p style="cursor: pointer;font-size: 15px" v-show="initial_open == 0" @click="openInitial" v-if="missionsDetail.initial == ''">无</p>
                <el-input type="text" v-model.trim="missionsDetail.initial" style="width: 90%;margin-bottom:1px" size="small" v-show="initial_open == 1"  @blur="updateTargetInitial" ref="initial"></el-input>
            </div>
            <div style="float: left;width: 33%" v-if="missionsDetail.type == '项目目标'">
              <p>量化指标-目标值：</p>
              <p style="cursor: pointer;font-size: 15px" v-show="target_open == 0" @click="openTarget" v-if="missionsDetail.target != ''">{{missionsDetail.target}}</p>
              <p style="cursor: pointer;font-size: 15px" v-show="target_open == 0" @click="openTarget" v-if="missionsDetail.target == ''">无</p>
              <el-input type="text" v-model.trim="missionsDetail.target" style="width: 90%;margin-bottom:5px" size="small" v-show="target_open == 1"  @blur="updateTargetTarget" ref="target"></el-input>
            </div>
            <div style="float: left;width: 33%" v-if="missionsDetail.type == '项目目标'">
              <p>量化指标-当前值：</p>
              <p style="cursor: pointer;font-size: 15px" v-show="current_open == 0" @click="openCurrent" v-if="missionsDetail.current != ''">{{missionsDetail.current}}</p>
              <p style="cursor: pointer;font-size: 15px" v-show="current_open == 0" @click="openCurrent" v-if="missionsDetail.current == ''">无</p>
              <el-input type="text" v-model.trim="missionsDetail.current" style="width: 90%;margin-bottom:1px" size="small" v-show="current_open == 1"  @blur="updateTargetCurrent" ref="current"></el-input>
            </div>
            <div style="float: left;width: 33%" v-if="missionsDetail.type == '项目费用'">
              <p>财务科目：</p>
              <p  slot="reference"v-show="finance_open == 0"><span style="cursor: pointer" @click="openFinance">{{missionsDetail.finance}}</span></p>
              <el-select v-model="missionsDetail.finance" placeholder="请选择" v-show="finance_open == 1" size="small"
                         @blur="finance_open = 0" @change="updateCostFinance" ref="finance" style="width: 50%;margin-bottom:1px;">
                <el-option
                  v-for="item in finances"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value"
                >
                </el-option>
              </el-select>
            </div>
            <div style="float: left;width: 33%" v-if="missionsDetail.type == '项目费用'">
              <p>预算金额：</p>
              <p style="cursor: pointer;font-size: 15px" v-show="budget_open == 0" @click="openBudget">{{missionsDetail.budget}}</p>
              <el-input type="text" v-model.trim="missionsDetail.budget" style="width: 90%;margin-bottom:1px" size="small" v-show="budget_open == 1"  @blur="updateCostBudget" ref="budget"></el-input>
            </div>
            <div style="float: left;width: 33%" v-if="missionsDetail.type == '项目费用'">
              <p>执行金额：</p>
              <p style="cursor: pointer;font-size: 15px" v-show="perform_open == 0" @click="openPerform">{{missionsDetail.execute}}</p>
              <el-input type="text" v-model.trim="missionsDetail.execute" style="width: 90%;margin-bottom:1px" size="small" v-show="perform_open == 1"  @blur="updateCostExecute" ref="perform"></el-input>
            </div>
            <div style="float: left;width: 33%" v-if="missionsDetail.type == '项目费用'">
              <p>发生日期：</p>
              <p slot="reference"v-show="occurrence_open == 0" style="margin-top:20px;"><span style="cursor: pointer;" @click="openOccurrence" v-if="missionsDetail.occurrence !=''">{{missionsDetail.occurrence}}</span></p>
              <p slot="reference"v-show="occurrence_open == 0"><span style="cursor: pointer" @click="openOccurrence" v-if="missionsDetail.occurrence ==''">无</span></p>
              <el-date-picker
                v-model="missionsDetail.occurrence"
                type="datetime"
                placeholder="选择日期时间"
                align="right"
                size="small"
                :editable="false"
                format="yyyy-MM-dd HH:mm:ss"
                value-format="yyyy-MM-dd HH:mm:ss"
                :picker-options="pickerOptions"
                v-show="occurrence_open == 1"
                @blur="occurrence_open = 0"
                @change="updateCostHappen"
                ref="occurrence"
                style="width: 90%;margin-bottom: 1px">
              </el-date-picker>
            </div>
            <div style="float: left;width: 33%" v-if="missionsDetail.type == '项目费用'">
              <p>付款日期：</p>
              <p  slot="reference"v-show="payment_open == 0"><span style="cursor: pointer" @click="openPayment" v-if="missionsDetail.payment != ''">{{missionsDetail.payment}}</span></p>
              <p  slot="reference"v-show="payment_open == 0"><span style="cursor: pointer" @click="openPayment" v-if="missionsDetail.payment == ''">无</span></p>
              <el-date-picker
                v-model="missionsDetail.payment"
                type="datetime"
                placeholder="选择日期时间"
                align="right"
                size="small"
                :editable="false"
                format="yyyy-MM-dd HH:mm:ss"
                value-format="yyyy-MM-dd HH:mm:ss"
                :picker-options="pickerOptions"
                v-show="payment_open == 1"
                @blur="payment_open = 0"
                @change="updateCostPay"
                ref="payment"
                style="width: 90%">
              </el-date-picker>
            </div>
            <div style="float: left;width: 100%">
              <p>参与人：</p>
              <el-select v-model="missionsDetail.participant" multiple placeholder="请选择" filterable style="width: 100%" :disabled="!MissionIsUpdate" @change="updateMissionParticipant">
                <el-option
                  v-for="item in members"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                  <el-avatar style="float:left; margin-top:3px;" size="small" :src="item.circleUrl"></el-avatar>
                  <span style="float:left">{{ item.label }}</span>
                </el-option>
              </el-select>
            </div>
            <div style="float: left;width: 100%">
              <p>描述：</p>
              <p  slot="reference">
                <span style="cursor: pointer" v-show="description_open == 0" @click="openDescription" v-if="missionsDetail.description != ''">{{missionsDetail.description}}</span>
                <span style="cursor: pointer" v-show="description_open == 0" @click="openDescription" v-else="missionsDetail.description == ''">无</span>
              </p>
                <el-input
                  type="textarea"
                  placeholder="评论内容，文字上限2000"
                  v-model="missionsDetail.description"
                  :value="missionsDetail.description"
                  maxlength="2000"
                  show-word-limit
                  resize="none"
                  rows="3"
                  v-show="description_open == 1"
                  ref="description"
                >
                </el-input>
                <div style="margin-top: 10px;" v-show="description_open == 1">
                  <el-button type="primary" size="mini" @click="updateMissionDescription">保存</el-button>
                  <el-button size="mini" @click.native="description_open = 0">取消</el-button>
                </div>
            </div>
            <div style="float: left;width: 100%" v-if="missionsDetail.type == '项目目标'">
              <p>验收标准：</p>
              <p  slot="reference">
                <span style="cursor: pointer" v-show="standard_open == 0" @click="openStandard" v-if="missionsDetail.standard != ''">{{missionsDetail.standard}}</span>
                <span style="cursor: pointer" v-show="standard_open == 0" @click="openStandard" v-else="missionsDetail.standard == ''">无</span>
              </p>
              <el-input
                type="textarea"
                placeholder="评论内容，文字上限2000"
                v-model="missionsDetail.standard"
                :value="missionsDetail.standard"
                maxlength="2000"
                show-word-limit
                resize="none"
                rows="3"
                v-show="standard_open == 1"
                ref="standard"
              >
              </el-input>
              <div style="margin-top: 10px;" v-show="standard_open == 1">
                <el-button type="primary" size="mini" @click="updateTargetStandard">保存</el-button>
                <el-button size="mini" @click.native="standard_open = 0">取消</el-button>
              </div>
            </div>
            <div style="float: left;width: 100%" v-if="missionsDetail.type == '项目目标'">
              <p>交付说明：</p>
              <p  slot="reference">
                <span style="cursor: pointer" v-show="explain_open == 0" @click="openExplain" v-if="missionsDetail.explain != ''">{{missionsDetail.explain}}</span>
                <span style="cursor: pointer" v-show="explain_open == 0" @click="openExplain" v-else="missionsDetail.explain == ''">无</span>
              </p>
              <el-input
                type="textarea"
                placeholder="评论内容，文字上限2000"
                v-model="missionsDetail.explain"
                :value="missionsDetail.explain"
                maxlength="2000"
                show-word-limit
                resize="none"
                rows="3"
                v-show="explain_open == 1"
                ref="explain"
              >
              </el-input>
              <div style="margin-top: 10px;" v-show="explain_open == 1">
                <el-button type="primary" size="mini" @click="updateTargetExplain">保存</el-button>
                <el-button size="mini" @click.native="explain_open = 0">取消</el-button>
              </div>
            </div>
            <div style="float: left;width: 100%" v-if="missionsDetail.type == '项目目标'">
              <p>验收反馈：</p>
              <p  slot="reference">
                <span style="cursor: pointer" v-show="feedback_open == 0" @click="openFeedback" v-if="missionsDetail.feedback != ''">{{missionsDetail.feedback}}</span>
                <span style="cursor: pointer" v-show="feedback_open == 0" @click="openFeedback" v-else="missionsDetail.feedback == ''">无</span>
              </p>
              <el-input
                type="textarea"
                placeholder="评论内容，文字上限2000"
                v-model="missionsDetail.feedback"
                :value="missionsDetail.feedback"
                maxlength="2000"
                show-word-limit
                resize="none"
                rows="3"
                v-show="feedback_open == 1"
                ref="feedback"
              >
              </el-input>
              <div style="margin-top: 10px;" v-show="feedback_open == 1">
                <el-button type="primary" size="mini" @click="updateTargetFeedback">保存</el-button>
                <el-button size="mini" @click.native="feedback_open = 0">取消</el-button>
              </div>
            </div>
            <div style="float: left;width: 100%" v-if="missionsDetail.type == '项目费用'">
              <p>付款信息：</p>
              <p  slot="reference">
                <span style="cursor: pointer" v-show="payMessage_open == 0" @click="openPayMessage" v-if="missionsDetail.payMessage != ''">{{missionsDetail.payMessage}}</span>
                <span style="cursor: pointer" v-show="payMessage_open == 0" @click="openPayMessage" v-if="missionsDetail.payMessage == ''">无</span>
              </p>
              <el-input
                type="textarea"
                placeholder="评论内容，文字上限2000"
                v-model="missionsDetail.payMessage"
                :value="missionsDetail.payMessage"
                maxlength="2000"
                show-word-limit
                resize="none"
                rows="3"
                v-show="payMessage_open == 1"
                ref="payMessage"
              >
              </el-input>
              <div style="margin-top: 10px;" v-show="payMessage_open == 1">
                <el-button type="primary" size="mini" @click="updateCostInformation">保存</el-button>
                <el-button size="mini" @click.native="payMessage_open = 0">取消</el-button>
              </div>
            </div>
          </el-tab-pane>
          <el-tab-pane name="second" v-if="missionsDetail.type == '项目任务'">
            <span slot="label"><i class="el-icon-share"></i> 子任务</span>
            <div class="clearfix" v-if="">
              <el-button type="primary" icon="el-icon-plus" size="small" style="float: right;margin-right: 10px;" v-if="MissionIsUpdate" @click="openAddSonMissionDialog">选择子任务</el-button>
            </div>
            <el-table
              :data="sonMission"
              style="width: 100%">
              <el-table-column
                prop="status"
                label="任务状态"
                width="180">
              </el-table-column>
              <el-table-column
                prop="name"
                label="任务名称"
                width="180">
              </el-table-column>
              <el-table-column
                prop="principal"
                label="负责人">
                <template slot-scope="scope">
                  <el-avatar style="float:left; margin-top:3px;" size="small" :src="scope.row.circleUrl"></el-avatar>
                  <span style="float:left;margin-left: 5px;margin-top: 8px">{{ scope.row.principal }}</span>
                </template>
              </el-table-column>
              <el-table-column
                prop="over"
                label="截止日期">
              </el-table-column>
              <el-table-column
                prop="operate"
                label="操作"
                show-overflow-tooltip>
                <template slot-scope="scope" v-if="MissionIsUpdate">
                  <el-tooltip class="item" effect="dark" content="取消" placement="bottom">
                    <i class="el-icon-delete" style="cursor: pointer; padding-left: 10px;" @click="deleteSonMission(scope.$index,scope.row.id)"></i>
                  </el-tooltip>
                </template>
              </el-table-column>
            </el-table>
            <div style="margin-top: 10px;text-align: center">
              <el-pagination
                background
                @size-change="SonMissionSizeChange"
                @current-change="SonMissionCurrentChange"
                :current-page="sonMissionCurrentPage"
                :page-sizes="[5, 6, 7, 8]"
                :page-size="sonMissionPageSize"
                layout="total, sizes, prev, pager, next, jumper"
                :total="sonMissionTotal">
              </el-pagination>
            </div>
          </el-tab-pane>
          <el-tab-pane name="third" v-if="missionsDetail.type != '项目任务'"><span slot="label"><i class="el-icon-sort"></i> 关联任务</span>
            <div class="clearfix">
              <el-button type="primary" icon="el-icon-edit" size="small" style="float: right;margin-right: 10px;" @click="openAddRelMissionDialog">选择关联任务</el-button>
            </div>
            <el-table
              :data="sonMission"
              style="width: 100%">
              <el-table-column
                prop="status"
                label="任务状态"
                width="180">
              </el-table-column>
              <el-table-column
                prop="name"
                label="任务名称"
                width="180">
              </el-table-column>
              <el-table-column
                prop="principal"
                label="负责人">
                <template slot-scope="scope">
                  <el-avatar style="float:left; margin-top:3px;" size="small" :src="scope.row.circleUrl"></el-avatar>
                  <span style="float:left;margin-left: 5px;margin-top: 8px">{{ scope.row.principal }}</span>
                </template>
              </el-table-column>
              <el-table-column
                prop="over"
                label="截止日期">
              </el-table-column>
              <el-table-column
                prop="operate"
                label="操作"
                show-overflow-tooltip>
                <template slot-scope="scope" v-if="MissionIsUpdate">
                  <el-tooltip class="item" effect="dark" content="取消" placement="bottom">
                    <i class="el-icon-delete" style="cursor: pointer; padding-left: 10px;" @click="deleteRelMission(scope.$index,scope.row.id)"></i>
                  </el-tooltip>
                </template>
              </el-table-column>
            </el-table>
            <div style="margin-top: 10px;text-align: center">
              <el-pagination
                background
                @size-change="SonMissionSizeChange"
                @current-change="SonMissionCurrentChange"
                :current-page="sonMissionCurrentPage"
                :page-sizes="[5, 6, 7, 8]"
                :page-size="sonMissionPageSize"
                layout="total, sizes, prev, pager, next, jumper"
                :total="sonMissionTotal">
              </el-pagination>
            </div>
          </el-tab-pane>
          <el-tab-pane name="fourth"><span slot="label"><i class="el-icon-connection"></i> 依赖关系</span>
            <div>
              <div class="clearfix" style="line-height: 32px">
                <span>前置任务</span>
                <el-button type="primary" icon="el-icon-edit" size="small" style="float: right;margin-right: 10px;" v-if="MissionIsUpdate" @click="openAddBeforeMissionDialog">选择前置任务</el-button>
              </div>
              <el-table
                :data="frontMission"
                style="width: 100%">
                <el-table-column
                  prop="status"
                  label="任务状态"
                  width="180">
                </el-table-column>
                <el-table-column
                  prop="name"
                  label="任务名称"
                  width="180">
                </el-table-column>
                <el-table-column
                  prop="principal"
                  label="负责人">
                  <template slot-scope="scope">
                    <el-avatar style="float:left; margin-top:3px;" size="small" :src="scope.row.circleUrl"></el-avatar>
                    <span style="float:left;margin-left: 5px;margin-top: 8px">{{ scope.row.principal }}</span>
                  </template>
                </el-table-column>
                <el-table-column
                  prop="over"
                  label="截止日期">
                </el-table-column>
                <el-table-column
                  prop="operate"
                  label="操作"
                  show-overflow-tooltip>
                  <template slot-scope="scope" v-if="MissionIsUpdate">
                    <el-tooltip class="item" effect="dark" content="取消" placement="bottom">
                      <i class="el-icon-delete" style="cursor: pointer; padding-left: 10px;" @click="deleteBeforeMission(scope.$index,scope.row.id)"></i>
                    </el-tooltip>
                  </template>
                </el-table-column>
              </el-table>
              <div style="margin-top: 10px;text-align: center">
                <el-pagination
                  background
                  @size-change="beforeSizeChange"
                  @current-change="beforeCurrentChange"
                  :current-page="frontMissionCurrentPage"
                  :page-sizes="[5, 6, 7, 8]"
                  :page-size="frontMissionPageSize"
                  layout="total, sizes, prev, pager, next, jumper"
                  :total="frontMissionTotal">
                </el-pagination>
              </div>
              <div class="clearfix" style="line-height: 32px">
                <span>后置任务</span>
                <el-button type="primary" icon="el-icon-edit" size="small" style="float: right;margin-right: 10px;" v-if="MissionIsUpdate" @click="openAddAfterMissionDialog">选择后置任务</el-button>
              </div>
              <el-table
                :data="afterMission"
                style="width: 100%">
                <el-table-column
                  prop="status"
                  label="任务状态"
                  width="180">
                </el-table-column>
                <el-table-column
                  prop="name"
                  label="任务名称"
                  width="180">
                </el-table-column>
                <el-table-column
                  prop="principal"
                  label="负责人">
                  <template slot-scope="scope">
                    <el-avatar style="float:left; margin-top:3px;" size="small" :src="scope.row.circleUrl"></el-avatar>
                    <span style="float:left;margin-left: 5px;margin-top: 8px">{{ scope.row.principal }}</span>
                  </template>
                </el-table-column>
                <el-table-column
                  prop="over"
                  label="截止日期">
                </el-table-column>
                <el-table-column
                  prop="operate"
                  label="操作"
                  show-overflow-tooltip>
                  <template slot-scope="scope" v-if="MissionIsUpdate">
                    <el-tooltip class="item" effect="dark" content="取消" placement="bottom">
                      <i class="el-icon-delete" style="cursor: pointer; padding-left: 10px;" @click="deleteAfterMission(scope.$index,scope.row.id)"></i>
                    </el-tooltip>
                  </template>
                </el-table-column>
              </el-table>
              <div style="margin-top: 10px;text-align: center">
                <el-pagination
                  background
                  @size-change="afterSizeChange"
                  @current-change="afterCurrentChange"
                  :current-page="afterMissionCurrentPage"
                  :page-sizes="[5, 6, 7, 8]"
                  :page-size="afterMissionPageSize"
                  layout="total, sizes, prev, pager, next, jumper"
                  :total="afterMissionTotal">
                </el-pagination>
              </div>
            </div>
          </el-tab-pane>
          <el-tab-pane name="fifth" v-if="missionsDetail.type == '项目任务'"><span slot="label"><i class="el-icon-alarm-clock"></i> 工时</span>
            <div>
              <p>当前任务工时</p>
              <p>预估 <span>{{forecastTime + '小时'}}</span>
                <el-popover
                placement="bottom"
                width="200"
                v-model="OpenforecastTime"
                trigger="click"
                v-if="MissionIsUpdate">
                <div>
                  <h4>预估工时</h4>
                  <el-input v-model="forecastTime" @blur="updateForecastTime"></el-input>
                </div>
                <el-button type="primary" icon="el-icon-edit" slot="reference" size="mini" style="margin-left: 10px;"></el-button>
              </el-popover>
              <span style="margin-left: 10px;">登记</span><span style="margin-left: 10px;">{{registerTime + '小时'}}</span>
              </p>
              <p>登记明细</p>
              <span>共登记 {{registerTimes}} 次（登记明细仅展示当前任务）</span>
              <el-button type="primary" class="el-icon-plus" style="float: right;margin-right: 10px;" size="small" @click="openAddWorkTimeDialog">登记工时</el-button>
              <el-table
                :data="registerDetail"
                style="width: 100%"
                :default-sort = "{prop: 'date', order: 'descending'}">
                <el-table-column
                  prop="time"
                  label="工时(小时)"
                  width="180">
                </el-table-column>
                <el-table-column
                  prop="type"
                  label="工时类别"
                  width="180">
                </el-table-column>
                <el-table-column
                  prop="description"
                  label="描述">
                </el-table-column>
                <el-table-column
                  prop="register"
                  label="登记人">
                  <template slot-scope="scope">
                    <el-avatar style="float:left; margin-top:3px;" size="small" :src="scope.row.circleUrl"></el-avatar>
                    <span style="float:left;margin-left: 5px;margin-top: 8px">{{ scope.row.register }}</span>
                  </template>
                </el-table-column>
                <el-table-column
                  prop="date"
                  sortable
                  label="工作日期">
                </el-table-column>
                <el-table-column
                  prop="operate"
                  label="操作"
                  show-overflow-tooltip>
                  <template slot-scope="scope">
                    <el-tooltip class="item" effect="dark" content="删除" placement="bottom">
                      <i class="el-icon-delete" style="cursor: pointer; padding-left: 10px;" v-if="userId == scope.row.registerId || MissionIsUpdate" @click="deleteWorkTime(scope.$index,scope.row.id)"></i>
                    </el-tooltip>
                  </template>
                </el-table-column>
              </el-table>
              <div style="margin-top: 10px;text-align: center">
                <el-pagination
                  background
                  @size-change="workTimeSizeChange"
                  @current-change="workTimeCurrentChange"
                  :current-page="registerDetailCurrentPage"
                  :page-sizes="[5, 6, 7, 8]"
                  :page-size="registerDetailPageSize"
                  layout="total, sizes, prev, pager, next, jumper"
                  :total="registerDetailTotal">
                </el-pagination>
              </div>
            </div>
          </el-tab-pane>
          <el-tab-pane name="sixth"><span slot="label"><i class="el-icon-link"></i> 附件</span>
            <span>共 {{fileNumber}} 个附件</span>
            <el-upload
              class="avatar-uploader"
              action="#"
              :show-file-list="false"
              style="float: right;margin-right:10px;"
              :http-request="addMissionFile"
              multiple>
              <el-button type="primary" icon="el-icon-plus" size="small" >添加附件</el-button>
            </el-upload>
            <el-table
              :data="fileTable"
              style="width: 100%">
              <el-table-column
                prop="name"
                label="文件名"
                width="180"
                show-overflow-tooltip>
              </el-table-column>
              <el-table-column
                prop="large"
                label="文件大小"
                width="180">
              </el-table-column>
              <el-table-column
                prop="person"
                label="上传人">
                <template slot-scope="scope">
                  <el-avatar style="float:left; margin-top:3px;" size="small" :src="scope.row.circleUrl"></el-avatar>
                  <span style="float:left;margin-left: 5px;margin-top: 8px">{{ scope.row.person }}</span>
                </template>
              </el-table-column>
              <el-table-column
                prop="date"
                label="上传时间">
              </el-table-column>
              <el-table-column
                prop="operate"
                label="操作">
                <template slot-scope="scope">
                  <el-tooltip class="item" effect="dark" content="下载" placement="bottom">
                    <i class="el-icon-bottom" style="cursor: pointer; padding-left: 10px;" @click="downloadMissionFile(scope.row.url)"></i>
                  </el-tooltip>
                  <el-tooltip class="item" effect="dark" content="删除" placement="bottom">
                    <i class="el-icon-delete" style="cursor: pointer; padding-left: 10px;" v-if="userId == scope.row.creatorId || MissionIsUpdate" @click="deleteMissionFile(scope.$index,scope.row.id)"></i>
                  </el-tooltip>
                </template>
              </el-table-column>
            </el-table>
            <div style="margin-top: 10px;text-align: center">
              <el-pagination
                background
                @size-change="AccessotySizeChange"
                @current-change="AccessotyCurrentChange"
                :current-page="fileTableCurrentPage"
                :page-sizes="[5, 6, 7, 8]"
                :page-size="fileTablePageSize"
                layout="total, sizes, prev, pager, next, jumper"
                :total="fileTableTotal">
              </el-pagination>
            </div>
          </el-tab-pane>
        </el-tabs>
        <el-tabs type="border-card" style="margin-top: 20px;" @tab-click="handleClickComment" v-model="commentActive">
          <el-tab-pane name="first">
            <span slot="label"><i class="el-icon-chat-dot-square"></i> 评论</span>
            <div>
              <div style="padding-bottom: 15px;border-bottom: 1px solid #909399;padding-top: 10px" v-for="(item,index) in comments">
                <el-avatar  :src="item.headImageUrl" style="float: left"></el-avatar>
                <span>{{item.name}}</span>
                <span style="font-size: 12px;margin-left: 5px;">{{item.date}}</span>
                <el-tooltip class="item" effect="dark" content="删除" placement="bottom">
                  <i class="el-icon-delete" style="cursor: pointer;float: right" v-if="isDeleteComment(item.issuerId)" @click="deleteMissionComment(index,item.id)"></i>
                </el-tooltip>
                <el-tooltip class="item" effect="dark" content="回复" placement="bottom">
                  <i class="el-icon-chat-line-square" style="cursor: pointer;float: right" v-if="isCanComment(item.issuerId)" @click="replyMissionComment(item.id,item.name,item.content)"></i>
                </el-tooltip>
                <div style="margin-top: 5px;">{{item.content}}</div>
              </div>
            </div>
            <div style="margin-top: 10px;text-align: center">
              <el-pagination
                background
                @size-change= "CommentSizeChange"
                @current-change="CommentCurrentChange"
                :current-page="commentCurrentPage"
                :page-sizes="[5, 6, 7, 8]"
                :page-size="commentPageSize"
                layout="total, sizes, prev, pager, next, jumper"
                :total="commentTotal">
              </el-pagination>
            </div>
          </el-tab-pane>
          <el-tab-pane name="second">
            <span slot="label"><i class="el-icon-data-line"></i> 活动</span>
            <el-table
              :data="activities"
              style="width: 100%">
              <el-table-column
                prop="updateTime"
                label="变更时间"
                width="180">
              </el-table-column>
              <el-table-column
                prop="updatePerson"
                label="变更人"
                width="180">
                <template slot-scope="scope">
                  <el-avatar style="float:left; margin-top:3px;" size="small" :src="scope.row.headImageUrl"></el-avatar>
                  <span style="float:left;margin-left: 5px;margin-top: 8px">{{ scope.row.updatePerson }}</span>
                </template>
              </el-table-column>
              <el-table-column
                prop="updateContent"
                label="变更内容">
              </el-table-column>
              <el-table-column
                prop="updateBefore"
                label="变更前">
              </el-table-column>
              <el-table-column
                prop="updateAfter"
                label="变更后">
              </el-table-column>
            </el-table>
            <div style="margin-top: 10px;text-align: center">
              <el-pagination
                background
                @size-change= "ActivitySizeChange"
                @current-change="ActivityCurrentChange"
                :current-page="activityCurrentPage"
                :page-sizes="[5, 6, 7, 8]"
                :page-size="activityPageSize"
                layout="total, sizes, prev, pager, next, jumper"
                :total="activityTotal">
              </el-pagination>
            </div>
          </el-tab-pane>
        </el-tabs>
        <p style="float: right">{{missionsDetail.createPerson}} 创建于 {{missionsDetail.createTime}}</p>
      </div>
      <div slot="footer" class="dialog-footer clearfix" style="border-top:2px solid #3a8ee6;padding-top: 10px;">
        <el-avatar @click.native ="drawer = true;"  :src="headImageUrl" style="cursor: pointer;float: left"></el-avatar>
        <el-collapse-transition>
          <el-input
            type="text"
            placeholder="评论内容，文字上限2000"
            class="footer_comment_input"
            v-show="comment_open === 0"
            @focus="openComment"
            :value="MissionComment"
          ></el-input>
        </el-collapse-transition>
        <el-collapse-transition>
          <el-input
            type="textarea"
            placeholder="评论内容，文字上限2000"
            v-model="MissionComment"
            :value="MissionComment"
            maxlength="2000"
            show-word-limit
            resize="none"
            class="footer_comment_textarea"
            v-show="comment_open === 1"
            ref="comment"
            rows="3"
          >
          </el-input>
        </el-collapse-transition>
        <el-collapse-transition>
          <div style="margin-top: 10px;float: right" v-show="comment_open === 1">
            <el-button size="mini" @click.native="comment_open = 0">取消</el-button>
            <el-button type="primary" size="mini" @click="createMissionComment">发送</el-button>
          </div>
        </el-collapse-transition>
      </div>
    </el-dialog>

    <!-- 审批详情窗口   -->
    <el-dialog
      :visible.sync="ExamineDialog"
      width="900px"
      :close-on-click-modal = "false"
    >
      <div slot="title">
        <i class="el-icon-s-check"></i>
        <span style="margin-right: 10px;font-size: 14px;">{{applyPerson[0].applicantName}}</span>
        <el-tag type="success" v-if="examineStatus == '已通过'">已通过</el-tag>
        <el-tag type="warning" v-if="examineStatus == '待审批'">待审批</el-tag>
        <el-tag type="danger" v-if="examineStatus == '已回拒'">已回拒</el-tag>
        <el-tag type="info" v-if="examineStatus == '已撤销'">已撤销</el-tag>
      </div>
      <div style="height: 600px;overflow: auto;border-top:2px solid #3a8ee6;padding-top:20px;">
        <div class="clearfix" style="line-height: 44px;">
            <div style="float: left">当前状态:</div>
            <div style="float: left" v-if="examineStatus == '待审批'">
              <span style="float: left">待</span>
              <el-avatar :src="examinePHead"  style="float: left"></el-avatar>
              {{examinePName}} 审批
            </div>
            <div style="float: left" v-if="examineStatus == '已通过'">
              <span style="float: left">审批已通过</span>
            </div>
            <div style="float: left" v-if="examineStatus == '已回拒'">
              <span style="float: left">审批已回拒</span>
            </div>
          <div style="float: left" v-if="examineStatus == '已撤销'">
            <span style="float: left">审批已撤销</span>
          </div>
          <div style="float: right">
            <el-button type="success" plain size="small" style="margin-right: 10px;" v-if="userId == currentExamineId" @click="agreeExamine">同意</el-button>
            <el-button type="danger" plain size="small" style="margin-right: 10px;" v-if="userId == currentExamineId" @click="refuseExamine">拒绝</el-button>
            <el-button plain size="small" style="margin-right: 10px;" v-if="userId == applyPerson[0].applicantId && examineStatus == '待审批'" @click="backExamine">撤销</el-button>
            <el-button type="warning" plain size="small" style="margin-right: 10px;" v-if="userId == applyPerson[0].applicantId && examineStatus == '待审批'" @click="noticeExamine">提醒</el-button>
            <el-button type="danger" plain size="small" style="margin-right: 10px;" v-if="userId == applyPerson[0].applicantId && examineStatus != '待审批'" @click="deleteExamine">删除</el-button>
          </div>
        </div>
        <div class="clearfix" style="margin:20px 0;">
          <span style="float: left;margin-bottom: 20px;">申请人</span>
          <span style="float: right">审批编号:{{examineNumber}}</span>
          <el-table
            :data="applyPerson"
            border
            style="width: 100%"
            :header-cell-style="{background:'#eef1f6',color:'#606266',textAlign:'center'}"
            :cell-style="{textAlign:'center'}">
            <el-table-column
              prop="name"
              label="姓名"
              width="180">
              <template slot-scope="scope">
                <div style="line-height: 40px;margin-left: 30px;">
                  <el-avatar :src="scope.row.applicantHead" style="float: left;"></el-avatar>
                  <div style="float: left">{{scope.row.applicantName}}</div>
                </div>
              </template>
            </el-table-column>
            <el-table-column
              prop="applicantDepartment"
              label="部门"
              width="180">
            </el-table-column>
            <el-table-column
              prop="applicantPost"
              label="职位">
            </el-table-column>
            <el-table-column
              prop="applicantTime"
              label="申请时间">
            </el-table-column>
          </el-table>
        </div>
        <div>
          <div style="margin-bottom: 20px">审批详情</div>
          <el-table
            :data="examineDetail"
            border
            :show-header="false"
            style="width: 100%"
            :cell-style="changeCellStyle">
            <el-table-column
              prop="title"
              label="标题"
              width="200">
            </el-table-column>
            <el-table-column
              prop="content">
              <template slot-scope="scope">
                <div v-if="scope.$index != 2">
                  <span>{{scope.row.content}}</span>
                </div>
                <div v-for="item in scope.row.content" v-if="scope.$index == 2">
                  <el-tooltip class="item" effect="dark" content="下载" placement="bottom">
                    <span style="cursor: pointer;" @click="downloadMissionFile(item.url)">{{item.accessory_name}}</span>
                  </el-tooltip>
                </div>
              </template>
            </el-table-column>
          </el-table>
        </div>
        <div style="margin:20px 0">
          <div>审批流程</div>
          <ul>
            <li style="float: left;width: 20%;margin-bottom: 10px;">
              <el-avatar :src="applyPerson[0].applicantHead" style="float: left"></el-avatar>
              <span>{{applyPerson[0].applicantName}}</span><br>
              <span>提交审批</span>
            </li>
            <li style="float: left;width: 20%;margin-bottom: 10px;" v-for="(item,index) in examineProcess">
              <el-avatar :src="item.examinePHead" style="float: left"></el-avatar>
              <span>{{item.examinePName}}</span><br>
              <span>{{item.status}}</span>
            </li>
            <li  style="float: left;width: 20%;" v-if="examineStatus == '待审批'">
              <div style="display:inline-block;width: 40px;height: 40px;border-radius: 50%;background-color: #eef1f6;text-align: center;line-height: 40px;"><i class="el-icon-check"></i></div>
              <span>审批通过</span>
            </li>
            <li  style="float: left;width: 20%;" v-if="examineStatus == '已通过'">
              <div style="display:inline-block;width: 40px;height: 40px;border-radius: 50%;background-color: #6cc142;text-align: center;line-height: 40px;"><i class="el-icon-check"></i></div>
              <span>审批通过</span>
            </li>
            <li  style="float: left;width: 20%;" v-if="examineStatus == '已回拒'">
              <div style="display:inline-block;width: 40px;height: 40px;border-radius: 50%;background-color: #c13e3e;text-align: center;line-height: 40px;"><i class="el-icon-close"></i></div>
              <span>已回拒</span>
            </li>
            <li  style="float: left;width: 20%;" v-if="examineStatus == '已撤销'">
              <div style="display:inline-block;width: 40px;height: 40px;border-radius: 50%;background-color: #eef1f6;text-align: center;line-height: 40px;"><i class="el-icon-minus"></i></div>
              <span>已撤销</span>
            </li>
          </ul>
          <el-table
            :data="examineProcess"
            border
            style="width: 100%"
            :header-cell-style="{background:'#eef1f6',color:'#606266',textAlign:'center'}">
            <el-table-column
              prop="name"
              label="审批"
              width="200">
              <template slot-scope="scope">
                <div style="line-height: 40px;">
                  <el-avatar :src="scope.row.examinePHead" style="float: left;"></el-avatar>
                  <div style="float: left">{{scope.row.examinePName}}</div>
                </div>
              </template>
            </el-table-column>
            <el-table-column
              prop="status"
              label="操作"
              width="400">
            </el-table-column>
            <el-table-column
              prop="date"
              label="审批时间">
            </el-table-column>
          </el-table>
        </div>
        <el-tabs type="border-card" style="margin-top: 20px;" @click="handleClickExamine" >
          <el-tab-pane>
            <span slot="label"><i class="el-icon-chat-dot-square"></i> 评论</span>
            <div>
              <div style="padding-bottom: 15px;border-bottom: 1px solid #909399;padding-top: 10px" v-for="(item,index) in comments">
                <el-avatar  :src="item.headImageUrl" style="float: left"></el-avatar>
                <span>{{item.name}}</span>
                <span style="font-size: 12px;margin-left: 5px;">{{item.date}}</span>
                <el-tooltip class="item" effect="dark" content="删除" placement="bottom">
                  <i class="el-icon-delete" style="cursor: pointer;float: right" v-if="isDeleteComment(item.issuerId)" @click="deleteExamineComment(index,item.id)"></i>
                </el-tooltip>
                <el-tooltip class="item" effect="dark" content="回复" placement="bottom">
                  <i class="el-icon-chat-line-square" style="cursor: pointer;float: right" v-if="isCanComment(item.issuerId)" @click="replyExamineComment(item.id,item.name,item.content)"></i>
                </el-tooltip>
                <div style="margin-top: 5px;">{{item.content}}</div>
              </div>
            </div>
            <div style="margin-top: 10px;text-align: center">
              <el-pagination
                background
                @size-change= "CommentSizeChange"
                @current-change="CommentCurrentChange"
                :current-page="commentCurrentPage"
                :page-sizes="[5, 6, 7, 8]"
                :page-size="commentPageSize"
                layout="total, sizes, prev, pager, next, jumper"
                :total="commentTotal">
              </el-pagination>
            </div>
          </el-tab-pane>
          <el-tab-pane>
            <span slot="label"><i class="el-icon-data-line"></i> 查阅记录</span>
            <el-timeline :reverse="reverse">
              <el-timeline-item
                v-for="(activity, index) in examineActivities"
                :key="index"
                :timestamp="activity.date">
                <el-avatar  :src="activity.headImageUrl" style="float: left"></el-avatar>
                {{activity.name}}
                {{activity.content}}
              </el-timeline-item>
            </el-timeline>
          </el-tab-pane>
        </el-tabs>
      </div>
      <div slot="footer" class="dialog-footer clearfix" style="border-top:2px solid #3a8ee6;padding-top: 10px;">
        <el-avatar @click.native ="drawer = true;"  :src="headImageUrl" style="cursor: pointer;float: left"></el-avatar>
        <el-collapse-transition>
          <el-input
            type="text"
            placeholder="评论内容，文字上限2000"
            class="footer_comment_input"
            v-show="comment_open === 0"
            @focus="openComment"
            :value="ExamineComment"
          ></el-input>
        </el-collapse-transition>
        <el-collapse-transition>
          <el-input
            type="textarea"
            placeholder="评论内容，文字上限2000"
            v-model="ExamineComment"
            :value="ExamineComment"
            maxlength="2000"
            show-word-limit
            resize="none"
            class="footer_comment_textarea"
            v-show="comment_open === 1"
            ref="comment"
            rows="3"
          >
          </el-input>
        </el-collapse-transition>
        <el-collapse-transition>
          <div style="margin-top: 10px;float: right" v-show="comment_open === 1">
            <el-button size="mini" @click.native="comment_open = 0">取消</el-button>
            <el-button type="primary" size="mini" @click="createExamineComment">发送</el-button>
          </div>
        </el-collapse-transition>
      </div>
    </el-dialog>

    <!-- 信息窗口   -->
    <el-dialog
      :visible.sync="MessageDialog"
      width="600px"
      :close-on-click-modal = "false"
    >
      <div slot="title">
        <i class="el-icon-s-opportunity"></i>
        <span style="font-size: 14px;">通知</span>
      </div>
      <el-tabs v-model="messageActive">
          <el-tab-pane label="未读" name="first"  style="height: 700px;overflow: auto;">
            <ul style="padding-left: 0;margin-top: 0">
              <li class="clearfix" style="border-bottom: 1px solid #c0c4cc;padding: 10px 0" v-for="(item,index) in UnReadmessage">
                <el-avatar :src="item.issuer_photo" style="float: left;"></el-avatar>
                <el-button type="primary" style="float: right" size="mini" @click="HasRead(index,item.id)">已读</el-button>
                  <span style="margin-left: 10px;">{{item.issuer_name}} {{item.activity}}</span><br>
                  <span style="margin-left: 10px;">{{item.content}}</span><br>
                  <span style="margin-left: 10px;">{{item.time}} {{item.type}}</span>
              </li>
            </ul>
        </el-tab-pane>
        <el-tab-pane label="已读" name="second"  style="height: 700px;overflow: auto;">
          <ul style="padding-left: 0;margin-top: 0">
            <li class="clearfix" style="border-bottom: 1px solid #c0c4cc;padding: 10px 0" v-for="(item,index) in Readmessage">
              <el-avatar :src="item.issuer_photo" style="float: left;"></el-avatar>
              <el-button type="danger" style="float: right" size="mini" @click="DeleteMessage(index,item.id)">删除</el-button>
              <span style="margin-left: 10px;">{{item.issuer_name}} {{item.activity}}</span><br>
              <span style="margin-left: 10px;">{{item.content}}</span><br>
              <span style="margin-left: 10px;">{{item.time}} {{item.type}}</span>
            </li>
          </ul>
        </el-tab-pane>
      </el-tabs>
    </el-dialog>

    <!-- 账号设置抽屉 -->
    <el-drawer
      title="个人资料"
      :visible.sync="drawer"
      :with-header="false"
      :modal="false"
      size="350px"
      >
      <div class="userDrawer">
        <div class="userDiv">
            <strong>个 人 资 料</strong>
          <el-tooltip effect="dark" content="退出账号" placement="bottom">
            <el-button class="el-icon-switch-button" type="danger" circle style="float: right" @click="signOut"></el-button>
          </el-tooltip>
          <div>
            <el-row>
              <el-col :span="10">
                <el-upload
                  class="avatar-uploader"
                  action="#"
                  :show-file-list="false"
                  :before-upload="beforeAvatarUpload"
                  :http-request="uploadHead">
                  <el-tooltip effect="dark" content="更换头像" placement="bottom">
                    <el-avatar :size="100" :src="headImageUrl" class="headImage">
                    </el-avatar>
                  </el-tooltip>
                </el-upload>
              </el-col>
              <el-col :span="14" class="userMessage">
                <span>{{memberName}}
                  <span class="littleFont">&nbsp;(@{{memberUserName}})</span>
                </span><br>
                <i class="el-icon-tickets"></i><span class="littleFont">{{memberNumber}}</span><br>
                <i class="el-icon-office-building"></i><span class="littleFont">{{memberDepartment}}</span><span v-if="memberDepartment == ''">无</span>&nbsp;&nbsp;
                <i class="el-icon-s-custom"></i><span class="littleFont">{{memberPost}}</span><br>
                <i class="el-icon-phone"></i>&nbsp;<span class="littleFont">{{memberPhone}}</span><br>
                <i class="el-icon-message"></i>&nbsp;<span class="littleFont">{{memberEmail}}</span>
              </el-col>
            </el-row>
            <hr style="border:1px dashed #fff;">
            <div class= "boxCardDiv">
                <el-card class="box-card" shadow="hover">
                  <el-collapse accordion >
                    <el-collapse-item title="修改用户名" name="1">
                      <el-input
                        placeholder="请输入用户名"
                        v-model="NewUserName"
                        clearable>
                      </el-input>
                      <div class="alterDiv">
                        <el-button type="primary" plain @click="updateUsername">修改</el-button>
                      </div>
                    </el-collapse-item>
                    <el-collapse-item title="修改密码" name="2">
                      <el-input
                        show-password
                        placeholder="请输入旧密码"
                        v-model="oldPassword"
                        clearable>
                      </el-input>
                      <el-input
                        show-password
                        placeholder="请输入新密码"
                        v-model="newPassword"
                        clearable
                        style="margin-top: 10px;">
                      </el-input>
                      <el-input
                        show-password
                        placeholder="确认密码"
                        v-model="newAgainPassword"
                        clearable
                        style="margin-top: 10px;">
                      </el-input>
                      <div class="alterDiv">
                        <el-button type="primary" plain @click="updatePassword">修改</el-button>
                      </div>
                    </el-collapse-item>
                    <el-collapse-item title="修改电话号码" name="3">
                      <el-input
                        placeholder="请输入手机号"
                        v-model="newPhone"
                        clearable>
                      </el-input>
                      <el-input
                        placeholder="请输入下方验证码"
                        v-model="imageCodeInput"
                        clearable
                        style="margin-top: 10px">
                      </el-input>
                      <div style="text-align: center">
                        <img :src="imageCode" @click="getCode" style="margin-top: 10px;cursor: pointer"/>
                        <el-button  :disabled="!ButtonShow" @click="getPhoneCode">
                          <span v-show="ButtonShow" >发送验证码</span>
                          <span v-show="!ButtonShow" class="count">{{ButtonCount}} s后可点击重发</span>
                        </el-button>
                      </div>
                      <el-input
                        placeholder="请输入验证码"
                        v-model="PhoneCode"
                        clearable
                        style="margin-top: 10px">
                      </el-input>
                      <div class="alterDiv">
                        <el-button type="primary" plain @click="updatePhone">修改</el-button>
                      </div>
                    </el-collapse-item>
                    <el-collapse-item title="修改邮箱" name="4">
                      <el-input
                        placeholder="请输入新的邮箱"
                        v-model="newEmail"
                        clearable>
                      </el-input>
                      <el-input
                        placeholder="请输入下方验证码"
                        v-model="imageEmailCodeInput"
                        clearable
                        style="margin-top: 10px">
                      </el-input>
                      <div style="text-align: center">
                        <img :src="imageCode" @click="getCode" style="margin-top: 10px;cursor: pointer"/>
                        <el-button  :disabled="!EmailShow" @click="getEmailCode">
                          <span v-show="EmailShow" >发送验证码</span>
                          <span v-show="!EmailShow" class="count">{{EmailCount}} s后可点击重发</span>
                        </el-button>
                      </div>
                      <el-input
                        placeholder="请输入验证码"
                        v-model="EmailCode"
                        clearable
                        style="margin-top: 10px">
                      </el-input>
                      <div class="alterDiv">
                        <el-button type="primary" plain @click="updateEmail">修改</el-button>
                      </div>
                    </el-collapse-item>
                  </el-collapse>
                </el-card>
            </div>
          </div>
        </div>
        <div style="text-align: center">
          <img class = "DownCat" src="../../assets/img/DownCat.png" alt="" >
        </div>
        </div>
    </el-drawer>
  </div>
</template>

<script>
  import Clipboard from 'clipboard';
  const axios = require('axios');
  const TIME_COUNT = 60 // 设置一个全局的倒计时的时间
  export default {
    name: "User",
    data() {
      let validateProjectNumber = (rule, value, callback) => {
          let reg = /^[a-zA-Z0-9]+$/
          if(!reg.test(value)){
            callback(new Error('只能输入字母和数字'))
          }else{
            callback();
          }
      };
      return {
        //企业名称
        EnterpriseName: "",

        MissionIsUpdate: false,
        WorkTimeUpdate: false,
        ExamineIsUpdate: false,

        //工时数据
        workTimeForm:{
          workTime: "",
          workType: "",
          workDate: "",
          workContent: "",
          missionValue: "",
          enterprise_id: "",
          creatorId:"",
        },
        headImageUrl: "",
        imageUrl: "",

        examineId:0,


        //用户信息
        memberName: "",
        memberUserName: "",
        memberNumber: "",
        memberDepartment: "",
        memberPost: "",
        memberPhone: "",
        memberEmail: "",
        userId: 0,

        //修改用户信息
        NewUserName: "",
        oldPassword: '',
        newPassword: '',
        newAgainPassword: '',
        newEmail: '',
        newPhone: '',
        EmailCode:'',
        ButtonShow: true,
        ButtonCount: 0,
        EmailShow: true,
        EmailCount: 0,
        phoneMessageId: '',
        emailCodeResult: '',
        createTime: '',
        imageCode: '',
        imageCodeInput: '',
        imageEmailCodeInput: '',
        imageCodeResult: '',
        PhoneCode: '',



        //校验规则
        rules:{
          name: [
            { required: true, message: '请输入项目名称', trigger: 'blur' },
          ],
          number: [
            { required: true, message: '项目编号不能为空', trigger: 'blur'},
            { max:20 , message: '最多不超过20字符', trigger: 'blur' },
            { validator: validateProjectNumber , trigger: 'blur'}
          ],
          scopeValue: [
            { required: true, message: '请选择可见范围', trigger: 'change'}
          ],
          projectsMembers: [
            { required: true, message: '请选择成员', trigger: 'change'}
          ]
        },

        addMissionFormRules:{
          title: [
            { required: true, message: "请输入任务名称", trigger: 'blur'},
          ],
          projectValue: [
            { required: true, message: '请选择项目',trigger:'change'},
          ],
          missionPrincipalValue: [
            {required: true, message: '请选择负责人',trigger:'change'}
          ],
          missionStart: [
            { required: true, message: '请选择开始日期',trigger:'change'},
          ],
          financialStaffs: [
            { required: true, message: "请选择财务人员", trigger: 'change'}
          ],
          finance: [
            { required: true, message: "请选择财务科目", trigger: 'change'}
          ],
          priority: [
            { required: true, message: "请选择优先级", trigger: 'change'}
          ],
          missionOver: [
            { required: true, message: '请选择截止日期',trigger:'change'},
          ],
          missionMember: [
            { required: true, message: '请选择参与人',trigger:'change'},
          ],
          projectProcess: [
            { required: true, message: '请选择项目阶段',trigger:'change'},
          ],
          missionType: [
            { required: true, message: '请选择任务类型',trigger:'change'}
          ]
        },

        workTimeFormRules:{
          missionValue:[
            {required: true, message: "请选择任务", trigger: 'change'},
          ],
          workDate:[
            { required: true, message: '请选择工作日期',trigger:'change'}
          ],
          workTime:[
            { required: true, message: '请填写工作时长',trigger:'blur'}
          ],
          workType:[
            { required: true, message: '请选择工作日期',trigger:'change'}
          ],
        },

        addExamineFormRules:{
          content:[
            { required: true, message: '请填写申请内容',trigger:'blur'}
          ],
          examinePeople:[
            { required: true, message: '请选择审批人',trigger:'change'}
          ],
        },

        fileNumber: 0,
        activeName: 'first',
        commentActive: 'first',
        messageActive: 'first',
        MissionComment: '',
        ExamineComment: '',
        forecastTime: 0,
        oldForecastTime: 0,



        //未读消息数量
        messageNumber: 0,

        comment_open: 0,
        title_open:0,
        status_open:0,
        principal_open: 0,
        start_open: 0,
        over_open:0,
        stage_open: 0,
        priority_open: 0,
        unit_open: 0,
        initial_open: 0,
        target_open: 0,
        current_open:0,
        finance_open:0,
        payment_open:0,
        budget_open:0,
        occurrence_open:0,
        perform_open:0,
        description_open: 0,
        standard_open: 0,
        explain_open: 0,
        feedback_open: 0,
        payMessage_open:0,
        registerTime:0,
        registerTimes:0,
        isCollapse: true,
        AddProjectsDialog: false,
        AddMissionDialog: false,
        AddExamineDialog: false,
        AddExamineFileDialog: false,
        AddWorkTimeDialog: false,
        AddSonMissionDialog: false,
        AddRelMissionDialog: false,
        AddBeforeMissionDialog: false,
        AddAfterMissionDialog: false,
        MissionDialog: false,
        drawer: false,
        OpenforecastTime: false,
        ExamineDialog: false,
        MessageDialog: false,
        reverse: true,

        //新建项目表单
        addProjectsForm: {
          name: '',
          number: '',
          scopeValue: "0",
          projectsMembers:[],
          projectsContent: "",
          enterprise_id: "",
          creatorId: "",
          level: "",
        },
        addMissionForm: {
          title: '',
          missionContent: "",
          missionMember: [],
          financialStaffs: [],
          projectValue: '',
          missionType: 2,
          missionPrincipalValue: "",
          missionStart: "",
          missionOver: "",
          projectProcess: "",
          priority: "",
          finance: "",
          budget: "",
          performAccount: "",
          enterprise_id: "",
          creatorId:"",
          level:"",
        },

        addExamineForm: {
          content:'',
          examineContent: "",
          examinePeople: [],
          userId: 0,
          enterpriseId: 0,
          fileList:[],
        },

        SonMissionSelect:[],
        RelMissionSelect:[],
        BeforeMissionSelect:[],
        AfterMissionSelect:[],

        addSonMissions: [],
        addRelMissions: [],
        addBeforeMissions:[],
        addAfterMissions: [],


        //审核流程
        examineProcess: [],

        //评论数据
        comments: [],
        //评论分页
        commentCurrentPage: 1,
        commentTotal: 0,
        commentPageSize: 5,
        //回复评论id
        replyCommentId: 0,

        //附件数据
        fileTable: [],
        //附件数据分页
        fileTableCurrentPage: 1,
        fileTableTotal: 0,
        fileTablePageSize: 5,

        //未读消息数据
        UnReadmessage: [],

        //已读消息数据
        Readmessage: [],

        //任务活动数据
        activities: [],
        //活动分页
        activityCurrentPage: 1,
        activityTotal: 0,
        activityPageSize: 5,

        //审批活动数据
        examineActivities: [],

        //任务详情数据
        missionsDetail: {
          number: "",
          name: '',
          state: "",
          oldState: '',
          principal: "",
          circleUrl: "",
          start: "",
          over: "",
          projectName: "",
          type: "",
          stage: "",
          priority: "",
          participant: [],
          newParticipant: [],
          description: "",
          finance: "",
          budget: "",
          execute: "",
          occurrence: "",
          payment: '',
          unit:"",
          initial: "",
          target: "",
          current: "",
          standard: '',
          explain: '',
          feedback:'',
          payMessage: "",
          createPerson: "",
          createTime: "",
          projectId: ""
        },

        //项目可见范围
        scope: [{
          value: '0',
          label: '私有：只有加入的成员才能看见此项目'
        }, {
          value: '1',
          label: '公开：企业所有成员都可以看见此项目'
        }],

        //子任务/关联任务数据
        sonMission:[],
        //子任务/关联任务分页
        sonMissionCurrentPage: 1,
        sonMissionTotal: 0,
        sonMissionPageSize: 5,

        //前置任务数据
        frontMission:[],
        //前置任务分页
        frontMissionCurrentPage: 1,
        frontMissionTotal: 0,
        frontMissionPageSize: 5,

        //后置任务数据
        afterMission:[],
        //后置任务分页
        afterMissionCurrentPage: 1,
        afterMissionTotal: 0,
        afterMissionPageSize: 5,

        //登记工时详情
        registerDetail:[],
        //登记工时详情分页
        registerDetailCurrentPage: 1,
        registerDetailTotal: 0,
        registerDetailPageSize: 5,

        //项目任务状态
        missionStatus: [{
          value:'未开始',
          label:'未开始',
        },{
          value: '进行中',
          label: '进行中'
        }, {
          value: '搁置中',
          label: '搁置中'
        }, {
          value: '已完成',
          label: '已完成'
        }],

        //任务目标状态
        TargetStatus:[{
          value:'未开始',
          label:'未开始',
        },{
          value: '可控',
          label: '可控'
        }, {
          value: '有风险',
          label: '有风险'
        }, {
          value: '失控',
          label: '失控'
        }, {
          value: '验收中',
          label: '验收中'
        },{
          value: '已完成',
          label: '已完成'
        }],

        //任务费用状态
        CostStatus:[{
          value:'未发生',
          label:'未发生',
        },{
          value: '已发生',
          label: '已发生'
        }, {
          value: '执行财务流程',
          label: '执行财务流程'
        }, {
          value: '完成财务流程',
          label: '完成财务流程'
        }, {
          value: '财务返回',
          label: '财务返回'
        }],

        //选择器企业成员数据
        members: [],

        //选择器项目数据
        projects: [],

        //选择器任务数据
        missions: [],

        //选择器任务类型
        type: [{
          value: 0,
          label: '项目目标'
        },
        {
          value: 1,
          label: '项目费用'
        },
        {
          value: 2,
          label: '项目任务'
        }],

        //优先级数据
        priorityArray: [{
          value: '最高',
          label: '最高'
        },
        {
          value: '较高',
          label: '较高'
        },
        {
          value: '普通',
          label: '普通'
        },
        {
          value: '较低',
          label: '较低'
        },
        {
          value: '最低',
          label: '最低'
        }],

        //工时类别数据
        workTypes: [{
          value: '设计',
          label: '设计'
        },
        {
          value: '研发',
          label: '研发'
        },
        {
          value: '文档',
          label: '文档'
        },
        {
          value: '测试',
          label: '测试'
        },
        {
          value: '其他',
          label: '其他'
        }],

        pickerOptions: {
          shortcuts: [{
            text: '今天',
            onClick(picker) {
              picker.$emit('pick', new Date());
            }
          }, {
            text: '昨天',
            onClick(picker) {
              const date = new Date();
              date.setTime(date.getTime() - 3600 * 1000 * 24);
              picker.$emit('pick', date);
            }
          }, {
            text: '一周前',
            onClick(picker) {
              const date = new Date();
              date.setTime(date.getTime() - 3600 * 1000 * 24 * 7);
              picker.$emit('pick', date);
            }
          }]
        },

        //审批申请人数据
        applyPerson: [{
          applicantId: 0,
          applicantName: '',
          applicantDepartment: '',
          applicantPost: '',
          applicantTime: '',
          applicantHead:'',
        }],

        examineNumber:'',
        examineStatus:'',
        examineId:0,
        examinePHead:'',
        examinePName:'',
        currentExamineId:'',

        //审批详情数据
        examineDetail: [{
          title:"申请内容",
          content:''
        },
          {
            title:"审批详情",
            content:''
          },
          {
            title:"附件",
            content: [],
          }
        ],

        //选择器任务项目阶段数据
        projectProcessArray: [{
          value: '启动阶段',
          label: '启动阶段'
        },
        {
          value: '执行阶段',
          label: '执行阶段'
        },
        {
          value: '验收阶段',
          label: '验收阶段'
        },
        {
          value: '结项阶段',
          label: '结项阶段'
        }],

        //选择器费用类型数据
        finances: [{
          value: '交通费',
          label: '交通费'
        }, {
          value: '餐费',
          label: '餐费'
        }, {
          value: '差旅费',
          label: '差旅费'
        }, {
          value: '住宿费',
          label: '住宿费'
        }, {
          value: '制作费',
          label: '制作费'
        },
        {
          value: '物料费',
          label: '物料费'
        }, {
          value: '租赁费',
          label: '租赁费'
        }, {
          value: '第三方服务费',
          label: '第三方服务费'
        }, {
          value: '劳务费',
          label: '劳务费'
        }]
      }
    },
    created() {
      this.$axios.all([
        axios.post('/getEnterPriseName', {'enterprise_id': window.localStorage.getItem("enterprise_id")}),
        axios.post('/getDepartmentName', {'department_id': window.localStorage.getItem("department_id")}),
        axios.post('/getPostName', {'post_id': window.localStorage.getItem("post_id")}),
        axios.post('/getMemberMessage', {"enterprise_id": window.localStorage.getItem("enterprise_id")}),
        axios.post('/getUserReadNotification', {'recipient_id': window.localStorage.getItem("id")}),
        axios.post('/getUserUnReadNotification', {'recipient_id': window.localStorage.getItem("id")}),
      ]).then(this.$axios.spread((res1, res2, res3, res4,res5,res6) => {
        this.EnterpriseName = res1.data.enterprise_name;
        if (res2.data != "") {
          this.memberDepartment = res2.data.depart_name;
        }
        this.memberPost = res3.data.post_name;
        this.members = res4.data;
        this.Readmessage = res5.data;
        this.UnReadmessage = res6.data;
        this.messageNumber = res6.data.length;
        if(this.messageNumber != 0){
          this.$notify.info({
            title: '通知',
            message: '您有' + this.messageNumber + '条未读消息,要去看下喔喵~',
            showClose:false
          });
        }
      }))
      this.userId = window.localStorage.getItem("id");
      this.headImageUrl = window.localStorage.getItem("photo");
      this.memberName = window.localStorage.getItem("name");
      this.memberUserName = window.localStorage.getItem("username"),
      this.memberNumber = window.localStorage.getItem("employee_id"),
      this.memberPhone = window.localStorage.getItem("phone"),
      this.memberEmail = window.localStorage.getItem("email"),
      this.addProjectsForm.level = window.localStorage.getItem("level");
      this.addMissionForm.level = window.localStorage.getItem("level");
      this.addProjectsForm.creatorId = window.localStorage.getItem("id");
      this.addMissionForm.creatorId = window.localStorage.getItem("id");
      this.workTimeForm.creatorId = window.localStorage.getItem("id");
      this.addExamineForm.userId = window.localStorage.getItem("id");
      this.addExamineForm.enterpriseId = window.localStorage.getItem("enterprise_id");
      this.addMissionForm.enterprise_id = window.localStorage.getItem("enterprise_id");
      this.addProjectsForm.enterprise_id = window.localStorage.getItem("enterprise_id");
      this.workTimeForm.enterprise_id = window.localStorage.getItem("enterprise_id");
      this.getCode()
      this.goEasy.connect({
        onSuccess: function () {  //连接成功
          console.log("GoEasy connect successfully.") //连接成功
        },
        onFailed: function (error) { //连接失败
          console.log("Failed to connect GoEasy, code:" + error.code + ",error:" + error.content);
        },
        onProgress: function (attempts) { //连接或自动重连中
          console.log("GoEasy is connecting", attempts);
        }
      });

      let self = this;
      this.goEasy.subscribe({
        channel: window.localStorage.getItem("id"),
        onMessage: function (message) {
          self.$notify.info({
            title: '通知',
            message: message.content,
            duration: 0
          });
          self.messageNumber++;
          axios.post('/getUserUnReadNotification', {'recipient_id': window.localStorage.getItem("id")}).then(res => {
            self.UnReadmessage = res.data;
          })
        },
        onSuccess: function () {
          console.log("Subscribe successfully.")
        },
        onFailed: function () {
          console.log("Subscribe successfully.")
        }
      });
    },
    mounted() {
      this.$notify({
        title: '欢迎回来',
        message: window.localStorage.getItem("name"),
        showClose:false
      });

    },
    methods: {
      openAddProjectsDialog() {
        this.AddProjectsDialog = true;
      },

      openAddMissionDialog() {
        this.AddMissionDialog = true;
      },

      openAddExamineDialog() {
        this.AddExamineDialog = true;
      },

      openAddExamineFileDialog(){
        this.AddExamineFileDialog = true;
      },

      openAddWorkTimeDialog() {
        axios.post('/getMissionByParticipant', {"id": window.localStorage.getItem("id")}).then(res => {
          this.missions = res.data;
        })
        this.AddWorkTimeDialog = true;
      },

      openAddSonMissionDialog() {
        axios.post('/getSelectSonMission', {"id": window.localStorage.getItem("enterprise_id")}).then(res => {
          this.addSonMissions = res.data;
        })
        this.AddSonMissionDialog = true;
      },

      openAddRelMissionDialog() {
        axios.post('/getSelectRelMission', {
          "id": this.missionsDetail.number,
          "enterpriseId": window.localStorage.getItem("enterprise_id")
        }).then(res => {
          this.addRelMissions = res.data;
        })
        this.AddRelMissionDialog = true;
      },

      openAddBeforeMissionDialog() {
        axios.post('/getSelectBeforeMission', {
          "id": this.missionsDetail.number,
          "enterpriseId": window.localStorage.getItem("enterprise_id")
        }).then(res => {
          this.addBeforeMissions = res.data;
        })
        this.AddBeforeMissionDialog = true;
      },

      openAddAfterMissionDialog() {
        axios.post('/getSelectAfterMission', {
          "id": this.missionsDetail.number,
          "enterpriseId": window.localStorage.getItem("enterprise_id")
        }).then(res => {
          this.addAfterMissions = res.data;
        })
        this.AddAfterMissionDialog = true;
      },

      openMissionDialog(id) {
        this.activeName = "first";
        this.activityCurrentPage = 1;
        this.commentCurrentPage = 1;
        this.$axios.all([
          axios.post('/getMissionMessage', {'id': id}),
          axios.post("/getMissionComment", {
            "pageCode": this.commentCurrentPage,
            "pageSize": this.commentPageSize,
            "id": id
          }),
          axios.post("/getMissionActivity", {
            "pageCode": this.activityCurrentPage,
            "pageSize": this.activityPageSize,
            "id": id
          }),
        ]).then(this.$axios.spread((res1, res2, res3) => {
          //   console.log(res1);
          // console.log(res2);
          this.missionsDetail.number = res1.data.number;
            this.missionsDetail.name = res1.data.name;
            this.missionsDetail.state = res1.data.state;
            this.missionsDetail.oldState = res1.data.state;
            this.missionsDetail.principal = res1.data.principal;
            this.missionsDetail.circleUrl = res1.data.circleUrl;
            this.missionsDetail.type = res1.data.type;
            this.missionsDetail.description = res1.data.description;
            this.missionsDetail.createTime = res1.data.createTime;
            this.missionsDetail.createPerson = res1.data.createPerson;
            this.missionsDetail.projectId = res1.data.projectId;
            this.missionsDetail.projectName = res1.data.projectName;
            this.missionsDetail.start = res1.data.start;
            this.missionsDetail.over = res1.data.over;
            let sArr = res1.data.participant.split(",");
            let iArr = [];
            for (let i = 0; i < sArr.length; i++) {
              if (sArr[i] != '') {
                iArr[i] = parseInt(sArr[i]);
              }
            }
            this.missionsDetail.participant = iArr;
            this.missionsDetail.newParticipant = iArr;
            if (res1.data.creatorId == window.localStorage.getItem("id") || res1.data.principalId == window.localStorage.getItem("id")
              || res1.data.projectCreatorId == window.localStorage.getItem("id") || res1.data.projectPrincipalId == window.localStorage.getItem("id")) {
              this.MissionIsUpdate = true;
            } else {
              this.MissionIsUpdate = false;
            }
          this.missionsDetail.priority = res1.data.priority;
            switch (res1.data.type) {
              case "项目目标":
                this.missionsDetail.unit = res1.data.unit;
                this.missionsDetail.initial = res1.data.initial;
                this.missionsDetail.target = res1.data.target;
                this.missionsDetail.current = res1.data.current;
                this.missionsDetail.standard = res1.data.standard;
                this.missionsDetail.explain = res1.data.explain;
                this.missionsDetail.feedback = res1.data.feedback;
                break;
              case "项目费用":
                this.missionsDetail.finance = res1.data.finance;
                this.missionsDetail.budget = res1.data.budget;
                this.missionsDetail.execute = res1.data.execute;
                this.missionsDetail.occurrence = res1.data.occurrence;
                this.missionsDetail.payment = res1.data.payment;
                this.missionsDetail.payMessage = res1.data.payMessage;
                break;
              case "项目任务":
                this.missionsDetail.stage = res1.data.stage;
                break;
            }
          this.commentTotal = res2.data.total;
          this.comments = res2.data.list;
          this.activityTotal = res3.data.total;
          this.activities = res3.data.list;
          })
        )
        this.MissionDialog = true;
      },

      openExamineDialog(id) {
        // this.activityCurrentPage = 1;
        this.commentCurrentPage = 1;
        this.$axios.all([
          axios.post('/getExamineMessages', {'id': id}),
          axios.post("/getExamineComment", {
            "pageCode": this.commentCurrentPage,
            "pageSize": this.commentPageSize,
            "id": id
          }),
          axios.post("/createExamineActivity", {
            "id": id,
            "enterpriseId": window.localStorage.getItem("enterprise_id"),
            "userId":window.localStorage.getItem("id"),
          }),
          axios.post("/getExamineActivity", {
            "id": id
          }),
        ]).then(this.$axios.spread((res1, res2, res3,res4) => {
              // console.log(res1);
              this.applyPerson[0].applicantDepartment = res1.data.applicantDepartment;
              this.applyPerson[0].applicantId = res1.data.applicantId;
              this.applyPerson[0].applicantHead = res1.data.applicantHead;
              this.applyPerson[0].applicantName = res1.data.applicantName;
              this.applyPerson[0].applicantPost = res1.data.applicantPost;
              this.applyPerson[0].applicantTime = res1.data.applicantTime;
              this.examineId = res1.data.examineId;
              this.examineNumber = res1.data.number;
              this.examineStatus = res1.data.status;
              this.examinePHead = res1.data.currentExaminePHead;
              this.examinePName = res1.data.currentExamineName;
              this.currentExamineId = res1.data.currentExamineId;
              this.examineDetail[0].content = res1.data.content;
              this.examineDetail[1].content = res1.data.detail;
              this.examineDetail[2].content = res1.data.files;
              this.examineProcess = res1.data.process;
              this.commentTotal = res2.data.total;
              this.comments = res2.data.list;
              this.examineActivities = res4.data;
          })
        )
        this.ExamineDialog = true;
      },

      openMessageDialog() {
        this.$axios.all([
          axios.post('/getUserReadNotification', {'recipient_id': window.localStorage.getItem("id")}),
          axios.post('/getUserUnReadNotification', {'recipient_id': window.localStorage.getItem("id")}),
        ]).then(this.$axios.spread((res1, res2) => {
          this.Readmessage = res1.data;
          this.UnReadmessage = res2.data;
          })
        )
        this.MessageDialog = true;
      },

      getProjects(callback) {
        if (callback == true) {
          axios.post('/getAllProjectList', {
            'id': window.localStorage.getItem("id"),
            'enterpriseId': window.localStorage.getItem("enterprise_id")
          }).then(res => {
            this.projects = res.data;
          })
        }
      },

      //退出
      signOut() {
        this.$confirm('确定要退出该账号吗?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning',
          center: true
        }).then(() => {
          this.goEasy.disconnect({
            onSuccess: function () {
              console.log("GoEasy disconnect successfully.")
            },
            onFailed: function (error) {
              console.log("Failed to disconnect GoEasy, code:" + error.code + ",error:" + error.content);
            }
          });
          window.localStorage.clear();
          this.$router.push("/login");
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消退出'
          });
        });
      },

      //修改用户名
      updateUsername() {
        let reg = /^1[345789]\d{9}$/
        if (this.NewUserName == '') {
          this.$message.error({
            message: '用户名不能为空喔喵~',
            center: true
          });
        } else if (reg.test(this.NewUserName)) {
          this.$message.error({
            message: '新用户名不能为手机号喔喵~',
            center: true
          });
        } else {
          axios.post('/updateUserName', {
            'username': this.NewUserName,
            'userId': window.localStorage.getItem("id")
          }).then(res => {
            if (res.data == 0) {
              this.$notify.warning({
                title: '注意',
                message: '该用户名已经存在',
              });
            } else {
              this.memberUserName = this.NewUserName;
              window.localStorage.setItem("username", this.NewUserName)
              this.$notify({
                title: '成功',
                message: '修改用户名成功',
                type: 'success'
              });
            }
          })
        }
      },

      //修改密码
      updatePassword() {
        if (this.oldPassword == '') {
          this.$message.error({
            message: '旧密码不能为空喔喵~',
            center: true
          });
        } else if (this.newPassword == '') {
          this.$message.error({
            message: '新密码不能为空喔喵~',
            center: true
          });
        } else if (this.newAgainPassword == '') {
          this.$message.error({
            message: '确认密码不能为空喔喵~',
            center: true
          });
        } else if (this.newPassword != this.newAgainPassword) {
          this.$message.error({
            message: '输入的密码不一致喔喵~',
            center: true
          });
        } else {
          axios.post('updatePassword', {
            'newPassword': this.newPassword,
            'oldPassword': this.oldPassword,
            'username': window.localStorage.getItem("username")
          }).then(res => {
            if (res.data == 0) {
              this.$notify.warning({
                title: '注意',
                message: '旧密码出错',
              });
            } else {
              this.$notify({
                title: '成功',
                message: '修改密码成功',
                type: 'success'
              });
            }
          })
        }
      },

      //获取图片验证码
      getCode() {
        this.$axios.get('/api/getcode').then(resp => {
          if (resp && resp.status === 200) {
            this.imageCode = resp.data.img
            this.imageCodeResult = resp.data.result
            // console.log(resp.data)
          }
        })
      },

      //发送手机验证码
      getPhoneCode() {
        if (this.newPhone === '') {
          this.$message.error({
            message: '请输入手机号码再获取验证码啊喵~',
            center: true
          });
        } else {
          let reg = /^1[345789]\d{9}$/
          if (!reg.test(this.newPhone)) {
            this.$message.error({
              message: '请输入格式正确的手机号码啊喵~',
              center: true
            });
          } else {
            if (this.imageCodeResult != this.imageCodeInput) {
              this.getCode();
              this.$message.error({
                message: '输入结果不对喔,再好好算喵~',
                center: true
              });
            } else {
              this.$axios.post('/api/sendMessage', {
                'phone': this.newPhone
              }).then(res => {
                // console.log(res);
                if (res.data.success == true) {
                  this.$message.success({
                    message: '我已经给你发送了喔！',
                    center: true
                  });
                  //存入信息ID
                  this.phoneMessageId = res.data.messageId;
                }
              })
              // 验证码倒计时
              if (!this.timer) {
                this.ButtonCount = TIME_COUNT
                this.ButtonShow = false
                this.timer = setInterval(() => {
                  if (this.ButtonCount > 0 && this.ButtonCount <= TIME_COUNT) {
                    this.ButtonCount--
                  } else {
                    this.ButtonShow = true
                    clearInterval(this.timer)
                    this.timer = null
                  }
                }, 1000)
              }
            }
          }
        }
      },

      //获取邮箱验证码
      getEmailCode() {
        if (this.newEmail === '') {
          this.$message.error({
            message: '请输入邮箱再获取验证码啊喵~',
            center: true
          });
        } else {
          let reg = /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/
          if (!reg.test(this.newEmail)) {
            this.$message.error({
              message: '请输入格式正确的邮箱啊喵~',
              center: true
            });
          } else {
            if (this.imageCodeResult != this.imageEmailCodeInput) {
              this.getCode();
              this.$message.error({
                message: '输入结果不对喔,再好好算喵~',
                center: true
              });
            } else {
              this.$axios.post('/api/mail', {
                'email': this.newEmail
              }).then(res => {
                // console.log(res);
                if (res.data.status == true) {
                  this.$message.success({
                    message: '我已经给你发送了喔！',
                    center: true
                  });
                  this.emailCodeResult = res.data.data;
                  this.createTime = res.data.date;
                }
              })
              // 验证码倒计时
              if (!this.timer) {
                this.EmailCount = TIME_COUNT
                this.EmailShow = false
                this.timer = setInterval(() => {
                  if (this.EmailCount > 0 && this.EmailCount <= TIME_COUNT) {
                    this.EmailCount--
                  } else {
                    this.EmailShow = true
                    clearInterval(this.timer)
                    this.timer = null
                  }
                }, 1000)
              }
            }
          }
        }
      },

      //修改手机
      updatePhone() {
        if (this.newPhone === '') {
          this.$message.error({
            message: '请输入手机号码啊喵~',
            center: true
          });
        } else {
          let reg = /^1[345789]\d{9}$/
          if (!reg.test(this.newPhone)) {
            this.$message.error({
              message: '请输入格式正确的手机号码啊喵~',
              center: true
            });
          } else {
            if (this.imageCodeResult != this.imageCodeInput) {
              this.getCode();
              this.$message.error({
                message: '输入结果不对喔,再好好算喵~',
                center: true
              });
            } else {
              axios.post("/api/checkMessage", {
                'messageId': this.phoneMessageId,
                'cacheCode': this.PhoneCode
              }).then(res => {
                if (res.data == true) {
                  axios.post("updatePhone", {
                    'phone': this.newPhone,
                    'userId': window.localStorage.getItem("id")
                  }).then(res => {
                    if (res.data == 0) {
                      this.$notify.warning({
                        title: '注意',
                        message: '已存在该手机',
                      });
                    } else {
                      this.memberPhone = this.newPhone;
                      window.localStorage.setItem("phone", this.newPhone);
                      this.$notify({
                        title: '成功',
                        message: '修改手机成功',
                        type: 'success'
                      });
                    }
                  })
                } else {
                  //验证失败或者信息过期
                  this.$message.error({
                    message: '验证码不对或者已经过期了喔，再试试或者重新发送吧',
                    center: true
                  });
                }
              })
            }
          }
        }
      },

      //修改邮箱
      updateEmail() {
        if (this.newEmail === '') {
          this.$message.error({
            message: '请输入邮箱啊喵~',
            center: true
          });
        } else {
          let reg = /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/
          if (!reg.test(this.newEmail)) {
            this.$message.error({
              message: '请输入格式正确的邮箱啊喵~',
              center: true
            });
          } else {
            if (this.imageCodeResult != this.imageEmailCodeInput) {
              this.getCode();
              this.$message.error({
                message: '输入结果不对喔,再好好算喵~',
                center: true
              });
            } else if (this.EmailCode == "") {
              this.$message.error({
                message: '验证码不能为空喔喵~',
                center: true
              });
            } else if (this.emailCodeResult != this.EmailCode) {
              this.$message.error({
                message: '验证码不对喔喵~',
                center: true
              });
            } else {
              // console.log(this.createTime);
              axios.post("updateEmail", {
                'email': this.newEmail,
                'createTime': this.createTime,
                'userId': window.localStorage.getItem("id")
              }).then(res => {
                if (res.data == 0) {
                  this.$notify.warning({
                    title: '注意',
                    message: '已存在该邮箱',
                  });
                } else if (res.data == 2) {
                  //信息过期
                  this.$message.error({
                    message: '验证码已经过期了喔，重新发送吧',
                    center: true
                  });
                } else {
                  this.memberEmail = this.newEmail;
                  window.localStorage.setItem("email", this.newEmail);
                  this.$notify({
                    title: '成功',
                    message: '修改邮箱成功',
                    type: 'success'
                  });
                }
              })
            }
          }
        }
      },

      //修改头像
      uploadHead(f) {
        let fd = new FormData(); //通过form数据格式来传
        fd.append("file", f.file);
        // console.log(fd.get('file'));
        axios.post('/uploadHead', fd, {'Content-Type': 'multipart/form-data'}).then(res => {
          // console.log(res);
          if (res.data.success == true) {
            this.headImageUrl = res.data.message;
            window.localStorage.setItem("photo", res.data.message);
            axios.post('/updateHeadImg', {
              "ImgName": res.data.fileName,
              "userId": window.localStorage.getItem("id")
            }).then(res => {
              if (res.data == 1) {
                this.$notify({
                  title: '成功',
                  message: '修改头像成功',
                  type: 'success'
                });
              } else {
                this.$notify.error({
                  title: '失败',
                  message: '修改头像失败',
                });
              }
            })
          }
        })
      },

      //添加任务附件
      addMissionFile(f){
        let fd = new FormData(); //通过form数据格式来传
        fd.append("file", f.file);
        // console.log(fd.get('file'));
        axios.post('/uploadFile', fd, {'Content-Type': 'multipart/form-data'}).then(res => {
          // console.log(res);
          if (res.data.success == true) {
            axios.post('/createMissionFile', {
              "fileName": res.data.message,
              "url":res.data.fileAddress,
              "size":res.data.size,
              "userId": window.localStorage.getItem("id"),
              "missionId":this.missionsDetail.number,
              "enterpriseId":window.localStorage.getItem("enterprise_id")
            }).then(res => {
              if (res.data == 1) {
                this.$notify({
                  title: '成功',
                  message: '上传成功',
                  type: 'success'
                });
              } else {
                this.$notify.error({
                  title: '失败',
                  message: '上传失败',
                });
              }
            })
          }
        })
      },

      addExmaineFile(f){
        let fd = new FormData(); //通过form数据格式来传
        fd.append("file", f.file);
        // console.log(fd.get('file'));
        axios.post('/uploadFile', fd, {'Content-Type': 'multipart/form-data'}).then(res => {
          // console.log(res);
          if (res.data.success == true) {
            axios.post('/createExamineFile', {
              "fileName": res.data.message,
              "url":res.data.fileAddress,
              "size":res.data.size,
              "userId": window.localStorage.getItem("id"),
              "ExamineId":this.examineId,
              "enterpriseId":window.localStorage.getItem("enterprise_id")
            }).then(res => {
              if (res.data == 1) {
                this.$notify({
                  title: '成功',
                  message: '上传成功',
                  type: 'success'
                });
                this.closeDialog();
              } else {
                this.$notify.error({
                  title: '失败',
                  message: '上传失败',
                });
              }
            })
          }
        })
      },

      beforeAvatarUpload(file) {
        const type = file.type === 'image/jpeg' || 'image/jpg' || 'image/webp' || 'image/png'
        const isLt2M = file.size / 1024 / 1024 < 2
        if (!type) {
          this.$message.error('图片格式不正确!(只能包含jpg，png，webp，JPEG)')
        }
        if (!isLt2M) {
          this.$message.error('上传图片大小不能超过 2MB!')
        }
        return type && isLt2M
      },

      //新建项目
      addProject(formName) {
        this.$refs[formName].validate((valid) => {
          if (valid) {
            axios.post("/createProject", this.addProjectsForm).then(res => {
              switch (res.data) {
                case 0:
                  this.$message.error({
                    message: '该项目编号已经存在了喔喵~',
                    center: true
                  });
                  break;
                case 1:
                  this.$notify({
                    title: '成功',
                    message: '创建项目成功',
                    type: 'success'
                  });
                  this.$refs["addProjectsForm"].resetFields();
                  this.closeDialog();
                  break;
                case 2:
                  this.$message.error({
                    message: '管理员职位还没有人担任喔~暂时没办法创建喔',
                    center: true
                  });
                  break;
                case 3:
                  this.$notify({
                    title: '成功',
                    message: '已经向管理员申请创建项目，等待审核结果',
                    type: 'success'
                  });
                  this.$refs["addProjectsForm"].resetFields();
                  this.closeDialog();
                  break;
              }
            })
          }
        });
      },

      //新建任务
      addMission(formName) {
        this.$refs[formName].validate((valid) => {
          if (valid) {
            if (this.addMissionForm.missionType == 0) {
              axios.post("/createTarget", this.addMissionForm).then(res => {
                switch (res.data) {
                  case 1:
                    this.$notify({
                      title: '成功',
                      message: '创建目标成功',
                      type: 'success'
                    });
                    this.$refs["addMissionForm"].resetFields();
                    this.closeDialog();
                    break;
                  case 2:
                    this.$message.error({
                      message: '该项目还没有负责人，请尽快安排负责人管理',
                      center: true
                    });
                    break;
                  case 3:
                    this.$notify({
                      title: '成功',
                      message: '已经向项目负责人申请创建项目，等待审核结果',
                      type: 'success'
                    });
                    this.$refs["addMissionForm"].resetFields();
                    this.closeDialog();
                    break;
                }
              })
            } else if (this.addMissionForm.missionType == 1) {
              axios.post("/createCost", this.addMissionForm).then(res => {
                switch (res.data) {
                  case 1:
                    this.$notify({
                      title: '成功',
                      message: '创建费用成功',
                      type: 'success'
                    });
                    this.$refs["addMissionForm"].resetFields();
                    this.closeDialog();
                    break;
                  case 2:
                    this.$message.error({
                      message: '该项目还没有负责人，请尽快安排负责人管理',
                      center: true
                    });
                    break;
                  case 3:
                    this.$notify({
                      title: '成功',
                      message: '已经向项目负责人申请创建项目，等待审核结果',
                      type: 'success'
                    });
                    this.$refs["addMissionForm"].resetFields();
                    this.closeDialog();
                    break;
                }
              })
            } else {
              if (Date.parse(this.addMissionForm.missionStart) > Date.parse(this.addMissionForm.missionOver)) {
                this.$message.error("开始时间不能超过截止日期");
              } else {
                axios.post("/createProjectMission", this.addMissionForm).then(res => {
                  switch (res.data) {
                    case 1:
                      this.$notify({
                        title: '成功',
                        message: '创建项目任务成功',
                        type: 'success'
                      });
                      this.$refs["addMissionForm"].resetFields();
                      this.closeDialog();
                      break;
                    case 2:
                      this.$message.error({
                        message: '该项目还没有负责人，请尽快安排负责人管理',
                        center: true
                      });
                      break;
                    case 3:
                      this.$notify({
                        title: '成功',
                        message: '已经向项目负责人申请创建项目，等待审核结果',
                        type: 'success'
                      });
                      this.$refs["addMissionForm"].resetFields();
                      this.closeDialog();
                      break;
                  }
                })
              }
            }
          }
        })
      },

      //新建审批
      addExamine(formName){
        this.$refs[formName].validate((valid) => {
          if (valid) {
            axios.post("/createExamine",this.addExamineForm).then(res => {
              this.examineId = res.data;
              this.openAddExamineFileDialog();
              this.$refs["addExamineForm"].resetFields();
            })
          }
        })
      },

      //新建工时
      addWorkTime(formName){
        this.$refs[formName].validate((valid) => {
          if (valid) {
            if(this.workTimeForm.workTime == 0){
              this.$message.error("工作时长不能为0")
            }else{
              axios.post("/createWorkTime",this.workTimeForm).then(res=> {
                if (res.data == 0) {
                  this.$notify.error({
                    title: '错误',
                    message: '修改失败'
                  });
                } else {
                  this.$notify({
                    title: '成功',
                    message: '新建成功',
                    type: 'success'
                  });
                  this.$refs["workTimeForm"].resetFields();
                  this.closeDialog();
                }
              })
            }
          }
        })
      },

      //已读消息
      HasRead(index, id) {
        axios.post("/updateNotificationStatue", {"id": id}).then(res => {
          if (res.data == 1) {
            this.$message({
              message: '该消息已读',
              type: 'success'
            });
            this.UnReadmessage.splice(index, 1);
            this.messageNumber--;
            axios.post('/getUserReadNotification', {'recipient_id': window.localStorage.getItem("id")}).then(res => {
              this.Readmessage = res.data;
            })
          } else {
            this.$message.error('已读失败');
          }
        })
      },

      //删除消息
      DeleteMessage(index, id) {
        this.$confirm('确定要删除该消息吗?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning',
          center: true
        }).then(() => {
          axios.post("/deleteMessage", {"id": id}).then(res => {
            if (res.data == 1) {
              this.$message({
                message: '删除成功',
                type: 'success'
              });
              this.Readmessage.splice(index, 1);
            } else {
              this.$message.error('删除失败')
            }
          })
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消删除'
          });
        });
      },

      ActivitySizeChange(val) {
        this.activityPageSize = val;
        axios.post("/getMissionActivity", {
          "pageCode": this.activityCurrentPage,
          "pageSize": this.activityPageSize,
          "id": this.missionsDetail.number
        }).then(res => {
          this.activityTotal = res.data.total;
          this.activities = res.data.list;
        })
      },

      ActivityCurrentChange(val) {
        this.activityCurrentPage = val;
        axios.post("/getMissionActivity", {
          "pageCode": this.activityCurrentPage,
          "pageSize": this.activityPageSize,
          "id": this.missionsDetail.number
        }).then(res => {
          this.activityTotal = res.data.total;
          this.activities = res.data.list;
        })
      },

      CommentSizeChange(val) {
        this.commentPageSize = val;
        axios.post("/getMissionComment", {
          "pageCode": this.commentCurrentPage,
          "pageSize": this.commentPageSize,
          "id": this.missionsDetail.number
        }).then(res => {
          this.commentTotal = res.data.total;
          this.comments = res.data.list;
        })
      },

      CommentCurrentChange(val) {
        this.commentCurrentPage = val;
        axios.post("/getMissionComment", {
          "pageCode": this.commentCurrentPage,
          "pageSize": this.commentPageSize,
          "id": this.missionsDetail.number
        }).then(res => {
          this.commentTotal = res.data.total;
          this.comments = res.data.list;
        })
      },

      handleClickComment(tab) {
        if (tab._data.index == 0) {
          axios.post("/getMissionComment", {
            "pageCode": this.commentCurrentPage,
            "pageSize": this.commentPageSize,
            "id": this.missionsDetail.number
          }).then(res => {
            this.commentTotal = res.data.total;
            this.comments = res.data.list;
          })
        } else {
          axios.post("/getMissionActivity", {
            "pageCode": this.activityCurrentPage,
            "pageSize": this.activityPageSize,
            "id": this.missionsDetail.number
          }).then(res => {
            this.activityTotal = res.data.total;
            this.activities = res.data.list;
          })
        }
      },

      handleClickExamine(tab) {
        if (tab._data.index == 0) {
          axios.post("/getExamineComment", {
            "pageCode": this.commentCurrentPage,
            "pageSize": this.commentPageSize,
            "id": this.examineId
          }).then(res => {
            this.commentTotal = res.data.total;
            this.comments = res.data.list;
          })
        } else {
          axios.post("/getExamineActivity", {
            "id": this.examineId
          }).then(res => {
            this.examineActivities = res.data;
          })
        }
      },

      SonMissionCurrentChange(val) {
        this.sonMissionCurrentPage = val;
        if (this.missionsDetail.type == "项目任务") {
          axios.post("/getSonMission", {
            "pageCode": this.sonMissionCurrentPage,
            "pageSize": this.sonMissionPageSize,
            "id": this.missionsDetail.number
          }).then(res => {
            this.sonMissionTotal = res.data.total;
            this.sonMission = res.data.list;
          })
        } else {
          axios.post("/getRelMission", {
            "pageCode": this.sonMissionCurrentPage,
            "pageSize": this.sonMissionPageSize,
            "id": this.missionsDetail.number
          }).then(res => {
            this.sonMissionTotal = res.data.total;
            this.sonMission = res.data.list;
          })
        }
      },

      SonMissionSizeChange(val) {
        this.sonMissionPageSize = val;
        if (this.missionsDetail.type == "项目任务") {
          axios.post("/getSonMission", {
            "pageCode": this.sonMissionCurrentPage,
            "pageSize": this.sonMissionPageSize,
            "id": this.missionsDetail.number
          }).then(res => {
            this.sonMissionTotal = res.data.total;
            this.sonMission = res.data.list;
          })
        } else {
          axios.post("/getRelMission", {
            "pageCode": this.sonMissionCurrentPage,
            "pageSize": this.sonMissionPageSize,
            "id": this.missionsDetail.number
          }).then(res => {
            this.sonMissionTotal = res.data.total;
            this.sonMission = res.data.list;
          })
        }
      },

      beforeCurrentChange(val) {
        this.frontMissionCurrentPage = val;
        axios.post("/getBeforeMission", {
          "pageCode": this.frontMissionCurrentPage,
          "pageSize": this.frontMissionPageSize,
          "id": this.missionsDetail.number
        }).then(res => {
          this.frontMissionTotal = res.data.total;
          this.frontMissionCurrentPage = 1;
          this.frontMission = res.data.list;
        })
      },

      beforeSizeChange(val) {
        this.frontMissionPageSize = val;
        axios.post("/getBeforeMission", {
          "pageCode": this.frontMissionCurrentPage,
          "pageSize": this.frontMissionPageSize,
          "id": this.missionsDetail.number
        }).then(res => {
          this.frontMissionTotal = res.data.total;
          this.frontMissionCurrentPage = 1;
          this.frontMission = res.data.list;
        })
      },

      afterCurrentChange(val) {
        this.afterMissionCurrentPage = val;
        axios.post("/getAfterMission", {
          "pageCode": this.afterMissionCurrentPage,
          "pageSize": this.afterMissionPageSize,
          "id": this.missionsDetail.number
        }).then(res => {
          this.afterMissionTotal = res.data.total;
          this.afterMissionCurrentPage = 1;
          this.afterMission = res.data.list;
        })
      },

      afterSizeChange(val) {
        this.afterMissionPageSize = val;
        axios.post("/getAfterMission", {
          "pageCode": this.afterMissionCurrentPage,
          "pageSize": this.afterMissionPageSize,
          "id": this.missionsDetail.number
        }).then(res => {
          this.afterMissionTotal = res.data.total;
          this.afterMissionCurrentPage = 1;
          this.afterMission = res.data.list;
        })
      },

      workTimeCurrentChange(val) {
        this.registerDetailCurrentPage = val;
        axios.post("/getMissionWork", {
          "pageCode": this.registerDetailCurrentPage,
          "pageSize": this.registerDetailPageSize,
          "id": this.missionsDetail.number
        }).then(res => {
          this.registerDetailTotal = res.data.total;
          this.registerTimes = res.data.total;
          this.registerDetailCurrentPage = 1;
          this.registerDetail = res.data.list;
        })
      },

      workTimeSizeChange(val) {
        this.registerDetailPageSize = val;
        axios.post("/getMissionWork", {
          "pageCode": this.registerDetailCurrentPage,
          "pageSize": this.registerDetailPageSize,
          "id": this.missionsDetail.number
        }).then(res => {
          this.registerDetailTotal = res.data.total;
          this.registerTimes = res.data.total;
          this.registerDetailCurrentPage = 1;
          this.registerDetail = res.data.list;
        })
      },

      AccessotyCurrentChange(val) {
        this.fileTableCurrentPage = val;
        axios.post("/getMissionFile", {
          "pageCode": this.fileTableCurrentPage,
          "pageSize": this.fileTablePageSize,
          "id": this.missionsDetail.number
        }).then(res => {
          this.fileNumber = res.data.total;
          this.fileTableTotal = res.data.total;
          this.fileTableCurrentPage = 1;
          this.fileTable = res.data.list;
        })
      },

      AccessotySizeChange(val) {
        this.fileTablePageSize = val;
        axios.post("/getMissionFile", {
          "pageCode": this.fileTableCurrentPage,
          "pageSize": this.fileTablePageSize,
          "id": this.missionsDetail.number
        }).then(res => {
          this.fileNumber = res.data.total;
          this.fileTableTotal = res.data.total;
          this.fileTableCurrentPage = 1;
          this.fileTable = res.data.list;
        })
      },


      MissionTab(tab) {
        switch (tab.name) {
          case "second":
            axios.post("/getSonMission", {
              "pageCode": this.sonMissionCurrentPage,
              "pageSize": this.sonMissionPageSize,
              "id": this.missionsDetail.number
            }).then(res => {
              this.sonMissionTotal = res.data.total;
              this.sonMissionCurrentPage = 1;
              this.sonMission = res.data.list;
            })
            break;
          case "third":
            axios.post("/getRelMission", {
              "pageCode": this.sonMissionCurrentPage,
              "pageSize": this.sonMissionPageSize,
              "id": this.missionsDetail.number
            }).then(res => {
              this.sonMissionTotal = res.data.total;
              this.sonMissionCurrentPage = 1;
              this.sonMission = res.data.list;
            })
            break;
          case "fourth":
            axios.post("/getBeforeMission", {
              "pageCode": this.frontMissionCurrentPage,
              "pageSize": this.frontMissionPageSize,
              "id": this.missionsDetail.number
            }).then(res => {
              this.frontMissionTotal = res.data.total;
              this.frontMissionCurrentPage = 1;
              this.frontMission = res.data.list;
            })
            axios.post("/getAfterMission", {
              "pageCode": this.afterMissionCurrentPage,
              "pageSize": this.afterMissionPageSize,
              "id": this.missionsDetail.number
            }).then(res => {
              this.afterMissionTotal = res.data.total;
              this.afterMissionCurrentPage = 1;
              this.afterMission = res.data.list;
            })
            break;
          case "fifth":
            axios.post("/getMissionWork", {
              "pageCode": this.registerDetailCurrentPage,
              "pageSize": this.registerDetailPageSize,
              "id": this.missionsDetail.number
            }).then(res => {
              this.registerDetailTotal = res.data.total;
              this.registerTimes = res.data.total;
              this.registerDetailCurrentPage = 1;
              this.registerDetail = res.data.list;
            });
            axios.post("/getMissionWorkTime",{
              "id":this.missionsDetail.number
            }).then(res => {
              this.forecastTime = res.data.prospect;
              this.oldForecastTime = res.data.prospect;
              this.registerTime = res.data.hour;
            })
            break;
          case "sixth":
            axios.post("/getMissionFile", {
              "pageCode": this.fileTableCurrentPage,
              "pageSize": this.fileTablePageSize,
              "id": this.missionsDetail.number
            }).then(res => {
              this.fileNumber = res.data.total;
              this.fileTableTotal = res.data.total;
              this.fileTableCurrentPage = 1;
              this.fileTable = res.data.list;
            })
            break;
        }
      },

      handleClick(tab, event) {
        console.log(tab, event);
      },

      openComment() {
        this.comment_open = 1;
        this.$nextTick(() => {
          this.$refs.comment.focus()
        })
      },

      openMissionTitle() {
        if (this.MissionIsUpdate) {
          this.title_open = 1;
          this.$nextTick(() => {
            this.$refs.title.focus()
          })
        }
      },

      openMissionStatus() {
        if (this.MissionIsUpdate) {
          this.status_open = 1;
          this.$nextTick(() => {
            this.$refs.missionStatus.focus()
          })
        }
      },

      openPrincipal() {
        if (this.MissionIsUpdate) {
          this.principal_open = 1;
          this.$nextTick(() => {
            this.$refs.principal.focus()
          })
        }
      },

      openStart() {
        if (this.MissionIsUpdate) {
          this.start_open = 1;
          this.$nextTick(() => {
            this.$refs.start.focus()
          })
        }
      },

      openOver() {
        if (this.MissionIsUpdate) {
          this.over_open = 1;
          this.$nextTick(() => {
            this.$refs.over.focus()
          })
        }
      },

      openStage() {
        if (this.MissionIsUpdate) {
          this.stage_open = 1;
          this.$nextTick(() => {
            this.$refs.stage.focus()
          })
        }
      },

      openPriority() {
        if (this.MissionIsUpdate) {
          this.priority_open = 1;
          this.$nextTick(() => {
            this.$refs.priority.focus()
          })
        }
      },

      openUnit() {
        if (this.MissionIsUpdate) {
          this.unit_open = 1;
          this.$nextTick(() => {
            this.$refs.unit.focus()
          })
        }
      },

      openInitial() {
        if (this.MissionIsUpdate) {
          this.initial_open = 1;
          this.$nextTick(() => {
            this.$refs.initial.focus()
          })
        }
      },

      openTarget() {
        if (this.MissionIsUpdate) {
          this.target_open = 1;
          this.$nextTick(() => {
            this.$refs.target.focus()
          })
        }
      },

      openCurrent() {
        if (this.MissionIsUpdate) {
          this.current_open = 1;
          this.$nextTick(() => {
            this.$refs.current.focus()
          })
        }
      },

      openFinance() {
        if (this.MissionIsUpdate) {
          this.finance_open = 1;
          this.$nextTick(() => {
            this.$refs.finance.focus()
          })
        }
      },

      openPayment() {
        if (this.MissionIsUpdate) {
          this.payment_open = 1;
          this.$nextTick(() => {
            this.$refs.payment.focus()
          })
        }
      },

      openBudget() {
        if (this.MissionIsUpdate) {
          this.budget_open = 1;
          this.$nextTick(() => {
            this.$refs.budget.focus()
          })
        }
      },

      openOccurrence() {
        if (this.MissionIsUpdate) {
          this.occurrence_open = 1;
          this.$nextTick(() => {
            this.$refs.occurrence.focus()
          })
        }
      },

      openPerform() {
        if (this.MissionIsUpdate) {
          this.perform_open = 1;
          this.$nextTick(() => {
            this.$refs.perform.focus()
          })
        }
      },

      openDescription() {
        if (this.MissionIsUpdate) {
          this.description_open = 1;
          this.$nextTick(() => {
            this.$refs.description.focus()
          })
        }
      },

      openStandard() {
        if (this.MissionIsUpdate) {
          this.standard_open = 1;
          this.$nextTick(() => {
            this.$refs.standard.focus()
          })
        }
      },

      openExplain() {
        if (this.MissionIsUpdate) {
          this.explain_open = 1;
          this.$nextTick(() => {
            this.$refs.explain.focus()
          })
        }
      },

      openFeedback() {
        if (this.MissionIsUpdate) {
          this.feedback_open = 1;
          this.$nextTick(() => {
            this.$refs.feedback.focus()
          })
        }
      },

      openPayMessage() {
        if (this.MissionIsUpdate) {
          this.payMessage_open = 1;
          this.$nextTick(() => {
            this.$refs.payMessage.focus()
          })
        }
      },

      //复制任务编号到粘贴板
      copy() {
        let clipboard = new Clipboard('.missionDialogTitle')
        clipboard.on('success', e => {
          this.$notify.success({
            title: '成功',
            message: '编号已成功复制到粘贴板',
            showClose: false
          });
          //  释放内存
          clipboard.destroy();
        })
        clipboard.on('error', e => {
          // 不支持复制
          console.log('该浏览器不支持复制')
          // 释放内存
          clipboard.destroy();
        })
      },

      changeCellStyle(row, column, rowIndex, columnIndex) {
        if (row.column.label === "标题") {
          return "background-color: #eef1f6;border:0"; // 修改的样式
        } else {
          return "";
        }
      },

      closeDialog() {
        this.AddProjectsDialog = false;
        this.AddMissionDialog = false;
        this.AddWorkTimeDialog = false;
        this.AddExamineFileDialog =false;
        this.AddExamineDialog =false;
      },

      updateMissionTitle() {
        if (this.missionsDetail.name == '') {
          this.$message.error('不能为空');
        } else {
          axios.post("/updateMissionTitle", {
            "title": this.missionsDetail.name, "id": this.missionsDetail.number,
            "userId": window.localStorage.getItem("id"), "enterpriseId": window.localStorage.getItem("enterprise_id")
          }).then(res => {
            if (res.data == 0) {
              this.$notify.error({
                title: '错误',
                message: '修改失败'
              });
            } else {
              this.$notify({
                title: '成功',
                message: '修改成功',
                type: 'success'
              });
              this.title_open = 0;
            }
          })
        }
      },

      updateMissionStatus() {
        switch (this.missionsDetail.type) {
          case "项目目标":
            if (this.missionsDetail.state == "未开始") {
              axios.post("/updateMissionStatus", {"status": 0, "id": this.missionsDetail.number})
              axios.post("/updateTargetStatus", {
                "status": this.missionsDetail.state,
                "id": this.missionsDetail.number,
                "userId": window.localStorage.getItem("id"),
                "enterpriseId": window.localStorage.getItem("enterprise_id")
              }).then(res => {
                if (res.data == 0) {
                  this.$notify.error({
                    title: '错误',
                    message: '修改失败'
                  });
                } else {
                  this.$notify({
                    title: '成功',
                    message: '修改成功',
                    type: 'success'
                  });
                  this.status_open = 0;
                }
              })
            } else if (this.missionsDetail.state == "已完成") {
              axios.post("/updateMissionStatus", {"status": 2, "id": this.missionsDetail.number}).then(res => {
                if (res.data == 0) {
                  this.$notify.error({
                    title: '错误',
                    message: '还有前置任务未完成，不能修改状态'
                  });
                }else{
                  axios.post("/updateTargetStatus", {
                    "status": this.missionsDetail.state,
                    "id": this.missionsDetail.number,
                    "userId": window.localStorage.getItem("id"),
                    "enterpriseId": window.localStorage.getItem("enterprise_id")
                  }).then(res => {
                    if (res.data == 0) {
                      this.$notify.error({
                        title: '错误',
                        message: '修改失败'
                      });
                    } else {
                      this.$notify({
                        title: '成功',
                        message: '修改成功',
                        type: 'success'
                      });
                      this.status_open = 0;
                    }
                  })
                }
              })
            } else {
              axios.post("/updateMissionStatus", {"status": 1, "id": this.missionsDetail.number})
              axios.post("/updateTargetStatus", {
                "status": this.missionsDetail.state,
                "id": this.missionsDetail.number,
                "userId": window.localStorage.getItem("id"),
                "enterpriseId": window.localStorage.getItem("enterprise_id")
              }).then(res => {
                if (res.data == 0) {
                  this.$notify.error({
                    title: '错误',
                    message: '修改失败'
                  });
                } else {
                  this.$notify({
                    title: '成功',
                    message: '修改成功',
                    type: 'success'
                  });
                  this.status_open = 0;
                }
              })
            }
            break;
          case "项目费用":
            if (this.missionsDetail.state == "未发生") {
              axios.post("/updateMissionStatus", {"status": 0, "id": this.missionsDetail.number})
              axios.post("/updateCostStatus", {
                "status": this.missionsDetail.state,
                "id": this.missionsDetail.number,
                "userId": window.localStorage.getItem("id"),
                "enterpriseId": window.localStorage.getItem("enterprise_id")
              }).then(res => {
                if (res.data == 0) {
                  this.$notify.error({
                    title: '错误',
                    message: '修改失败'
                  });
                } else {
                  this.$notify({
                    title: '成功',
                    message: '修改成功',
                    type: 'success'
                  });
                  this.status_open = 0;
                }
              })
            } else if (this.missionsDetail.state == "完成财务流程") {
              axios.post("/updateMissionStatus", {"status": 2, "id": this.missionsDetail.number}).then(res => {
                if (res.data == 0) {
                  this.$notify.error({
                    title: '错误',
                    message: '还有前置任务未完成，不能修改状态'
                  });
                }else{
                  axios.post("/updateCostStatus", {
                    "status": this.missionsDetail.state,
                    "id": this.missionsDetail.number,
                    "userId": window.localStorage.getItem("id"),
                    "enterpriseId": window.localStorage.getItem("enterprise_id")
                  }).then(res => {
                    if (res.data == 0) {
                      this.$notify.error({
                        title: '错误',
                        message: '修改失败'
                      });
                    } else {
                      this.$notify({
                        title: '成功',
                        message: '修改成功',
                        type: 'success'
                      });
                      this.status_open = 0;
                    }
                  })
                }
              })
            } else {
              axios.post("/updateMissionStatus", {"status": 1, "id": this.missionsDetail.number})
              axios.post("/updateCostStatus", {
                "status": this.missionsDetail.state,
                "id": this.missionsDetail.number,
                "userId": window.localStorage.getItem("id"),
                "enterpriseId": window.localStorage.getItem("enterprise_id")
              }).then(res => {
                if (res.data == 0) {
                  this.$notify.error({
                    title: '错误',
                    message: '修改失败'
                  });
                } else {
                  this.$notify({
                    title: '成功',
                    message: '修改成功',
                    type: 'success'
                  });
                  this.status_open = 0;
                }
              })
            }
            break;
          case "项目任务":
            if (this.missionsDetail.state == "未开始") {
              axios.post("/updateMissionStatus", {"status": 0, "id": this.missionsDetail.number})
              axios.post("/updateMissionProjectStatus", {
                "status": this.missionsDetail.state,
                "id": this.missionsDetail.number,
                "userId": window.localStorage.getItem("id"),
                "enterpriseId": window.localStorage.getItem("enterprise_id")
              }).then(res => {
                if (res.data == 0) {
                  this.$notify.error({
                    title: '错误',
                    message: '修改失败'
                  });
                } else {
                  this.$notify({
                    title: '成功',
                    message: '修改成功',
                    type: 'success'
                  });
                  this.status_open = 0;
                }
              })
            } else if (this.missionsDetail.state == "已完成") {
              axios.post("/updateMissionStatus", {"status": 2, "id": this.missionsDetail.number}).then(res => {
                if (res.data == 0) {
                  this.$notify.error({
                    title: '错误',
                    message: '还有前置任务未完成，不能修改状态'
                  });
                }else{
                  axios.post("/updateMissionProjectStatus", {
                    "status": this.missionsDetail.state,
                    "id": this.missionsDetail.number,
                    "userId": window.localStorage.getItem("id"),
                    "enterpriseId": window.localStorage.getItem("enterprise_id")
                  }).then(res => {
                    if (res.data == 0) {
                      this.$notify.error({
                        title: '错误',
                        message: '修改失败'
                      });
                    } else {
                      this.$notify({
                        title: '成功',
                        message: '修改成功',
                        type: 'success'
                      });
                      this.status_open = 0;
                    }
                  })
                }
              })
            } else {
              axios.post("/updateMissionStatus", {"status": 1, "id": this.missionsDetail.number})
              axios.post("/updateMissionProjectStatus", {
                "status": this.missionsDetail.state,
                "id": this.missionsDetail.number,
                "userId": window.localStorage.getItem("id"),
                "enterpriseId": window.localStorage.getItem("enterprise_id")
              }).then(res => {
                if (res.data == 0) {
                  this.$notify.error({
                    title: '错误',
                    message: '修改失败'
                  });
                } else {
                  this.$notify({
                    title: '成功',
                    message: '修改成功',
                    type: 'success'
                  });
                  this.status_open = 0;
                }
              })
            }
            break;
        }
      },

      updateMissionPrincipal(id) {
        let obj = {};
        obj = this.members.find((item) => {//这里的userList就是上面遍历的数据源
          return item.value === id;//筛选出匹配数据
        });
        axios.post("/updateMissionPrincipal", {
          "principal_id": obj.value, "id": this.missionsDetail.number,
          "userId": window.localStorage.getItem("id"), "enterpriseId": window.localStorage.getItem("enterprise_id")
        }).then(res => {
          if (res.data == 0) {
            this.$notify.error({
              title: '错误',
              message: '修改失败'
            });
          } else {
            this.$notify({
              title: '成功',
              message: '修改成功',
              type: 'success'
            });
            this.principal_open = 0;
            this.missionsDetail.circleUrl = obj.circleUrl;
            this.missionsDetail.principal = obj.label;
          }
        })
      },

      updateMissionStart() {
        if (Date.parse(this.missionsDetail.start) > Date.parse(this.missionsDetail.over)) {
          this.$message.error("开始时间不能超过截止日期");
        } else {
          axios.post("/updateMissionStart", {
            "start_date": this.missionsDetail.start, "id": this.missionsDetail.number,
            "userId": window.localStorage.getItem("id"), "enterpriseId": window.localStorage.getItem("enterprise_id")
          }).then(res => {
            if (res.data == 0) {
              this.$notify.error({
                title: '错误',
                message: '修改失败'
              });
            } else {
              this.$notify({
                title: '成功',
                message: '修改成功',
                type: 'success'
              });
              this.start_open = 0;
            }
          })
        }
      },

      updateMissionOver() {
        if (Date.parse(this.missionsDetail.start) > Date.parse(this.missionsDetail.over)) {
          this.$message.error("开始时间不能超过截止日期");
        } else {
          axios.post("/updateMissionOver", {
            "over_date": this.missionsDetail.over, "id": this.missionsDetail.number,
            "userId": window.localStorage.getItem("id"), "enterpriseId": window.localStorage.getItem("enterprise_id")
          }).then(res => {
            if (res.data == 0) {
              this.$notify.error({
                title: '错误',
                message: '修改失败'
              });
            } else {
              this.$notify({
                title: '成功',
                message: '修改成功',
                type: 'success'
              });
              this.over_open = 0;
            }
          })
        }
      },

      updateMissionPhase() {
        axios.post("/updateMissionPhase", {
          "phase": this.missionsDetail.stage, "id": this.missionsDetail.number,
          "userId": window.localStorage.getItem("id"), "enterpriseId": window.localStorage.getItem("enterprise_id")
        }).then(res => {
          if (res.data == 0) {
            this.$notify.error({
              title: '错误',
              message: '修改失败'
            });
          } else {
            this.$notify({
              title: '成功',
              message: '修改成功',
              type: 'success'
            });
            this.stage_open = 0;
          }
        })
      },

      updateMissionPriority() {
        axios.post("/updateMissionPriority", {
          "priority": this.missionsDetail.priority, "id": this.missionsDetail.number,
          "userId": window.localStorage.getItem("id"), "enterpriseId": window.localStorage.getItem("enterprise_id")
        }).then(res => {
          if (res.data == 0) {
            this.$notify.error({
              title: '错误',
              message: '修改失败'
            });
          } else {
            this.$notify({
              title: '成功',
              message: '修改成功',
              type: 'success'
            });
            this.priority_open = 0;
          }
        })
      },

      updateMissionDescription() {
        axios.post("/updateMissionDescription", {
          "description": this.missionsDetail.description, "id": this.missionsDetail.number,
          "userId": window.localStorage.getItem("id"), "enterpriseId": window.localStorage.getItem("enterprise_id")
        }).then(res => {
          if (res.data == 0) {
            this.$notify.error({
              title: '错误',
              message: '修改失败'
            });
          } else {
            this.$notify({
              title: '成功',
              message: '修改成功',
              type: 'success'
            });
            this.description_open = 0;
          }
        })
      },

      updateMissionParticipant() {
        axios.post("/updateMissionParticipant", {
          "participant": this.missionsDetail.participant, "id": this.missionsDetail.number,
          "userId": window.localStorage.getItem("id"), "enterpriseId": window.localStorage.getItem("enterprise_id")
        }).then(res => {
          if (res.data == 0) {
            this.$notify.error({
              title: '错误',
              message: '修改失败'
            });
          } else {
            this.$notify({
              title: '成功',
              message: '修改成功',
              type: 'success'
            });
          }
        })
      },

      updateTargetUnit() {
        axios.post("/updateTargetUnit", {
          "unit": this.missionsDetail.unit, "id": this.missionsDetail.number,
          "userId": window.localStorage.getItem("id"), "enterpriseId": window.localStorage.getItem("enterprise_id")
        }).then(res => {
          if (res.data == 0) {
            this.$notify.error({
              title: '错误',
              message: '修改失败'
            });
          } else {
            this.$notify({
              title: '成功',
              message: '修改成功',
              type: 'success'
            });
          }
        })
        this.unit_open = 0;
      },

      updateTargetInitial() {
        let reg = /^(-?\d+)(\.\d+)?$/;
        if (!reg.test(this.missionsDetail.initial)) {
          this.$message.error('只能输入数字');
        } else {
          axios.post("/updateTargetInitial", {
            "initial_value": this.missionsDetail.initial, "id": this.missionsDetail.number,
            "userId": window.localStorage.getItem("id"), "enterpriseId": window.localStorage.getItem("enterprise_id")
          }).then(res => {
            if (res.data == 0) {
              this.$notify.error({
                title: '错误',
                message: '修改失败'
              });
            } else {
              this.$notify({
                title: '成功',
                message: '修改成功',
                type: 'success'
              });
            }
          })
          this.initial_open = 0;
        }
      },

      updateTargetTarget() {
        let reg = /^(-?\d+)(\.\d+)?$/;
        if (!reg.test(this.missionsDetail.target)) {
          this.$message.error('只能输入数字');
        } else {
          axios.post("/updateTargetTarget", {
            "target_value": this.missionsDetail.target, "id": this.missionsDetail.number,
            "userId": window.localStorage.getItem("id"), "enterpriseId": window.localStorage.getItem("enterprise_id")
          }).then(res => {
            if (res.data == 0) {
              this.$notify.error({
                title: '错误',
                message: '修改失败'
              });
            } else {
              this.$notify({
                title: '成功',
                message: '修改成功',
                type: 'success'
              });
            }
          })
          this.target_open = 0;
        }
      },

      updateTargetCurrent() {
        let reg = /^(-?\d+)(\.\d+)?$/;
        if (!reg.test(this.missionsDetail.current)) {
          this.$message.error('只能输入数字');
        } else {
          axios.post("/updateTargetCurrent", {
            "current_value": this.missionsDetail.current, "id": this.missionsDetail.number,
            "userId": window.localStorage.getItem("id"), "enterpriseId": window.localStorage.getItem("enterprise_id")
          }).then(res => {
            if (res.data == 0) {
              this.$notify.error({
                title: '错误',
                message: '修改失败'
              });
            } else {
              this.$notify({
                title: '成功',
                message: '修改成功',
                type: 'success'
              });
            }
          })
          this.current_open = 0;
        }
      },

      updateTargetExplain() {
        axios.post("/updateTargetExplain", {
          "explain": this.missionsDetail.explain, "id": this.missionsDetail.number,
          "userId": window.localStorage.getItem("id"), "enterpriseId": window.localStorage.getItem("enterprise_id")
        }).then(res => {
          if (res.data == 0) {
            this.$notify.error({
              title: '错误',
              message: '修改失败'
            });
          } else {
            this.$notify({
              title: '成功',
              message: '修改成功',
              type: 'success'
            });
          }
        })
        this.explain_open = 0;
      },

      updateTargetFeedback() {
        axios.post("/updateTargetFeedback", {
          "feedback": this.missionsDetail.feedback, "id": this.missionsDetail.number,
          "userId": window.localStorage.getItem("id"), "enterpriseId": window.localStorage.getItem("enterprise_id")
        }).then(res => {
          if (res.data == 0) {
            this.$notify.error({
              title: '错误',
              message: '修改失败'
            });
          } else {
            this.$notify({
              title: '成功',
              message: '修改成功',
              type: 'success'
            });
          }
        })
        this.feedback_open = 0;
      },

      updateTargetStandard() {
        axios.post("/updateTargetStandard", {
          "standard": this.missionsDetail.standard, "id": this.missionsDetail.number,
          "userId": window.localStorage.getItem("id"), "enterpriseId": window.localStorage.getItem("enterprise_id")
        }).then(res => {
          if (res.data == 0) {
            this.$notify.error({
              title: '错误',
              message: '修改失败'
            });
          } else {
            this.$notify({
              title: '成功',
              message: '修改成功',
              type: 'success'
            });
          }
        })
        this.standard_open = 0;
      },

      updateCostFinance() {
        axios.post("/updateCostFinance", {
          "finance": this.missionsDetail.finance, "id": this.missionsDetail.number,
          "userId": window.localStorage.getItem("id"), "enterpriseId": window.localStorage.getItem("enterprise_id")
        }).then(res => {
          if (res.data == 0) {
            this.$notify.error({
              title: '错误',
              message: '修改失败'
            });
          } else {
            this.$notify({
              title: '成功',
              message: '修改成功',
              type: 'success'
            });
          }
        })
        this.finance_open = 0;
      },

      updateCostBudget() {
        let reg = /^(-?\d+)(\.\d+)?$/;
        if (!reg.test(this.missionsDetail.budget)) {
          this.$message.error('只能输入数字');
        } else {
          axios.post("/updateCostBudget", {
            "budget": this.missionsDetail.budget, "id": this.missionsDetail.number,
            "userId": window.localStorage.getItem("id"), "enterpriseId": window.localStorage.getItem("enterprise_id")
          }).then(res => {
            if (res.data == 0) {
              this.$notify.error({
                title: '错误',
                message: '修改失败'
              });
            } else {
              this.$notify({
                title: '成功',
                message: '修改成功',
                type: 'success'
              });
            }
          })
          this.budget_open = 0;
        }
      },

      updateCostExecute() {
        let reg = /^(-?\d+)(\.\d+)?$/;
        if (!reg.test(this.missionsDetail.execute)) {
          this.$message.error('只能输入数字');
        } else {
          axios.post("/updateCostExecute", {
            "execute": this.missionsDetail.execute, "id": this.missionsDetail.number,
            "userId": window.localStorage.getItem("id"), "enterpriseId": window.localStorage.getItem("enterprise_id")
          }).then(res => {
            if (res.data == 0) {
              this.$notify.error({
                title: '错误',
                message: '修改失败'
              });
            } else {
              this.$notify({
                title: '成功',
                message: '修改成功',
                type: 'success'
              });
            }
          })
          this.perform_open = 0;
        }
      },

      updateCostHappen() {
        axios.post("/updateCostHappen", {
          "happen_date": this.missionsDetail.occurrence, "id": this.missionsDetail.number,
          "userId": window.localStorage.getItem("id"), "enterpriseId": window.localStorage.getItem("enterprise_id")
        }).then(res => {
          if (res.data == 0) {
            this.$notify.error({
              title: '错误',
              message: '修改失败'
            });
          } else {
            this.$notify({
              title: '成功',
              message: '修改成功',
              type: 'success'
            });
          }
        })
        this.occurrence_open = 0;
      },

      updateCostPay() {
        axios.post("/updateCostPay", {
          "payment_id": this.missionsDetail.payment, "id": this.missionsDetail.number,
          "userId": window.localStorage.getItem("id"), "enterpriseId": window.localStorage.getItem("enterprise_id")
        }).then(res => {
          if (res.data == 0) {
            this.$notify.error({
              title: '错误',
              message: '修改失败'
            });
          } else {
            this.$notify({
              title: '成功',
              message: '修改成功',
              type: 'success'
            });
          }
        })
        this.payment_open = 0;
      },

      updateCostInformation() {
        axios.post("/updateCostInformation", {
          "information": this.missionsDetail.payMessage, "id": this.missionsDetail.number,
          "userId": window.localStorage.getItem("id"), "enterpriseId": window.localStorage.getItem("enterprise_id")
        }).then(res => {
          if (res.data == 0) {
            this.$notify.error({
              title: '错误',
              message: '修改失败'
            });
          } else {
            this.$notify({
              title: '成功',
              message: '修改成功',
              type: 'success'
            });
          }
        })
        this.payMessage_open = 0;
      },

      isCanComment(issuerId) {
        if (issuerId != window.localStorage.getItem('id')) {
          return true;
        } else {
          return false;
        }
      },

      isDeleteComment(issuerId) {
        if (issuerId == window.localStorage.getItem('id')) {
          return true;
        } else {
          return false;
        }
      },

      deleteMissionComment(index, id) {
        this.$confirm('确定要删除该评论吗?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning',
          center: true
        }).then(() => {
          axios.post("/deleteMissionComment", {"id": id}).then(res => {
            if (res.data == 1) {
              this.$message({
                message: '删除成功',
                type: 'success'
              });
              this.comments.splice(index, 1);
              this.commentTotal--;
            } else {
              this.$message.error('删除失败')
            }
          })
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消删除'
          });
        });
      },

      deleteExamineComment(index,id){
        this.$confirm('确定要删除该评论吗?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning',
          center: true
        }).then(() => {
          axios.post("/deleteExamineComment", {"id": id}).then(res => {
            if (res.data == 1) {
              this.$message({
                message: '删除成功',
                type: 'success'
              });
              this.comments.splice(index, 1);
              this.commentTotal--;
            } else {
              this.$message.error('删除失败')
            }
          })
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消删除'
          });
        });
      },

      replyMissionComment(id, name, content) {
        this.MissionComment = "回复 @" + name + ":" + content + "->";
        this.replyCommentId = id;
      },

      replyExamineComment(id, name, content) {
        this.ExamineComment = "回复 @" + name + ":" + content + "->";
        this.replyCommentId = id;
      },

      createMissionComment() {
        if (this.MissionComment == "") {
          this.$message.error('不能发送空内容');
        } else {
          if (this.MissionComment.indexOf("回复 @") == -1) {
            this.replyCommentId = 0;
          }
          axios.post("/createMissionComment", {
            "userId": window.localStorage.getItem("id"),
            "content": this.MissionComment,
            "enterpriseId": window.localStorage.getItem("enterprise_id"),
            "id": this.missionsDetail.number,
            "replyCommentId": this.replyCommentId
          }).then(res => {
            if (res.data == 0) {
              this.$notify.error({
                title: '错误',
                message: '修改失败'
              });
            } else {
              this.$notify({
                title: '成功',
                message: '发送成功',
                type: 'success'
              });
              this.MissionComment = "";
              this.comment_open = 0;
              this.commentCurrentPage = 1;
              axios.post("/getMissionComment", {
                "pageCode": this.commentCurrentPage,
                "pageSize": this.commentPageSize,
                "id": this.missionsDetail.number
              }).then(res => {
                this.commentTotal = res.data.total;
                this.comments = res.data.list;
              })
            }
          })
        }
      },

      createExamineComment(){
        if (this.ExamineComment == "") {
          this.$message.error('不能发送空内容');
        } else {
          if (this.ExamineComment.indexOf("回复 @") == -1) {
            this.replyCommentId = 0;
          }
          axios.post("/createExamineComment", {
            "userId": window.localStorage.getItem("id"),
            "content": this.ExamineComment,
            "enterpriseId": window.localStorage.getItem("enterprise_id"),
            "id": this.examineId,
            "replyCommentId": this.replyCommentId
          }).then(res => {
            if (res.data == 0) {
              this.$notify.error({
                title: '错误',
                message: '发送失败'
              });
            } else {
              this.$notify({
                title: '成功',
                message: '发送成功',
                type: 'success'
              });
              this.ExamineComment = "";
              this.comment_open = 0;
              this.commentCurrentPage = 1;
              axios.post("/getExamineComment", {
                "pageCode": this.commentCurrentPage,
                "pageSize": this.commentPageSize,
                "id": this.examineId
              }).then(res => {
                this.commentTotal = res.data.total;
                this.comments = res.data.list;
              })
            }
          })
        }
      },

      addSonMissionSelect(val) {
        for (let i = 0; i < val.length; i++) {
          this.SonMissionSelect[i] = val[i].id;
        }
      },

      updateSonMission() {
        axios.post('/updateSonMission', {
          "SonMissionSelect": this.SonMissionSelect,
          "id": this.missionsDetail.number
        }).then(res => {
          if (res.data == 0) {
            this.$notify.error({
              title: '错误',
              message: '选择失败'
            });
          } else {
            this.$notify({
              title: '成功',
              message: '选择成功',
              type: 'success'
            });
          }
        })
        this.AddSonMissionDialog = false;
      },

      deleteSonMission(index, id) {
        axios.post("/deleteSonMission", {"id": id}).then(res => {
          if (res.data == 0) {
            this.$notify.error({
              title: '错误',
              message: '取消失败'
            });
          } else {
            this.$notify({
              title: '成功',
              message: '取消成功',
              type: 'success'
            });
            this.sonMission.splice(index, 1);
            this.sonMissionTotal--;
          }
        })
      },

      updateRelMission() {
        axios.post('/updateRelMission', {
          "RelMissionSelect": this.RelMissionSelect,
          "id": this.missionsDetail.number
        }).then(res => {
          if (res.data == 0) {
            this.$notify.error({
              title: '错误',
              message: '选择失败'
            });
          } else {
            this.$notify({
              title: '成功',
              message: '选择成功',
              type: 'success'
            });
          }
        })
        this.AddRelMissionDialog = false;
      },

      addRelMissionSelect(val) {
        for (let i = 0; i < val.length; i++) {
          this.RelMissionSelect[i] = val[i].id;
        }
      },

      deleteRelMission(index, id) {
        axios.post("/deleteRelMission", {"id": this.missionsDetail.number, "missionId": id}).then(res => {
          if (res.data == 0) {
            this.$notify.error({
              title: '错误',
              message: '取消失败'
            });
          } else {
            this.$notify({
              title: '成功',
              message: '取消成功',
              type: 'success'
            });
            this.sonMission.splice(index, 1);
            this.sonMissionTotal--;
          }
        })
      },

      updateBeforeMission() {
        axios.post('/updateBeforeMission', {
          "BeforeMissionSelect": this.BeforeMissionSelect,
          "id": this.missionsDetail.number
        }).then(res => {
          if (res.data == 0) {
            this.$notify.error({
              title: '错误',
              message: '选择失败'
            });
          } else {
            this.$notify({
              title: '成功',
              message: '选择成功',
              type: 'success'
            });
          }
        })
        this.AddBeforeMissionDialog = false;
      },

      addBeforeMissionSelect(val) {
        for (let i = 0; i < val.length; i++) {
          this.BeforeMissionSelect[i] = val[i].id;
        }
      },

      deleteBeforeMission(index, id) {
        axios.post("/deleteBeforeMission", {"id": this.missionsDetail.number, "missionId": id}).then(res => {
          if (res.data == 0) {
            this.$notify.error({
              title: '错误',
              message: '取消失败'
            });
          } else {
            this.$notify({
              title: '成功',
              message: '取消成功',
              type: 'success'
            });
            this.frontMission.splice(index, 1);
            this.frontMissionTotal--;
          }
        })
      },

      updateAfterMission() {
        axios.post('/updateAfterMission', {
          "AfterMissionSelect": this.AfterMissionSelect,
          "id": this.missionsDetail.number
        }).then(res => {
          if (res.data == 0) {
            this.$notify.error({
              title: '错误',
              message: '选择失败'
            });
          } else {
            this.$notify({
              title: '成功',
              message: '选择成功',
              type: 'success'
            });
          }
        })
        this.AddAfterMissionDialog = false;
      },

      addAfterMissionSelect(val) {
        for (let i = 0; i < val.length; i++) {
          this.AfterMissionSelect[i] = val[i].id;
        }
      },

      deleteAfterMission(index, id) {
        axios.post("/deleteBeforeMission", {"id": this.missionsDetail.number, "missionId": id}).then(res => {
          if (res.data == 0) {
            this.$notify.error({
              title: '错误',
              message: '取消失败'
            });
          } else {
            this.$notify({
              title: '成功',
              message: '取消成功',
              type: 'success'
            });
            this.afterMission.splice(index, 1);
            this.afterMissionTotal--;
          }
        })
      },

      updateForecastTime(){
        let reg = /^(-?\d+)(\.\d+)?$/;
        if(this.forecastTime == ""){
          this.$message.error("不能输入为空");
          this.forecastTime = this.oldForecastTime;
        }else if(!reg.test(this.forecastTime)){
          this.$message.error("只能输入数字")
          this.forecastTime = this.oldForecastTime;
        }else{
          axios.post("/updateProspect",{"id":this.missionsDetail.number,"prospect":this.forecastTime}).then(res => {
            if (res.data == 0) {
              this.$notify.error({
                title: '错误',
                message: '修改失败'
              });
            } else {
              this.$notify({
                title: '成功',
                message: '修改成功',
                type: 'success'
              });
            }
            this.oldForecastTime = this.forecastTime;
          })
        }
      },

      deleteWorkTime(index,id){
        axios.post("/deleteWorkTime",{"id":id}).then(res => {
          if (res.data == 0) {
            this.$notify.error({
              title: '错误',
              message: '删除失败'
            });
          } else {
            this.$notify({
              title: '成功',
              message: '删除成功',
              type: 'success'
            });
            this.registerDetail.splice(index,1);
            this.registerDetailTotal--;
          }
        })
      },

      deleteMissionFile(index,id){
        axios.post("/deleteMissionFile",{"id":id}).then(res => {
          if (res.data == 0) {
            this.$notify.error({
              title: '错误',
              message: '删除失败'
            });
          } else {
            this.$notify({
              title: '成功',
              message: '删除成功',
              type: 'success'
            });
            this.fileTable.splice(index,1);
            this.fileTableTotal--;
          }
        })
      },

      //下载任务文件
      downloadMissionFile(fileurl){
        // console.log(fileurl);
        // axios.post("/download",{"id":id})
        location.href=fileurl;
      },

      deleteMission(){
        this.$confirm('确定要回收该任务吗?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning',
          center: true
        }).then(() => {
          axios.post("/deleteMission",{"id":this.missionsDetail.number}).then(res => {
            if (res.data == 0) {
              this.$notify.error({
                title: '错误',
                message: '删除失败'
              });
            } else {
              this.$notify({
                title: '成功',
                message: '删除成功',
                type: 'success'
              });
              this.MissionDialog = false;
            }
          })
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消删除'
          });
        })
      },

      agreeExamine(){
        this.$confirm('确定要同意审批吗?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning',
          center: true
        }).then(() => {
          axios.post("/agreeExamine",{"id":this.examineId,"userId":window.localStorage.getItem("id"),"enterpriseId":window.localStorage.getItem("enterprise_id")}).then(res => {
            if (res.data == 0) {
              this.$notify.error({
                title: '错误',
                message: '审批失败'
              });
            } else {
              this.$notify({
                title: '成功',
                message: '审批成功',
                type: 'success'
              });
              this.ExamineDialog = false;
            }
          })
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消同意'
          });
        })
      },

      backExamine(){
        this.$confirm('确定要撤销审批吗?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning',
          center: true
        }).then(() => {
          axios.post("/backExamine",{"id":this.examineId,"userId":window.localStorage.getItem("id"),"enterpriseId":window.localStorage.getItem("enterprise_id")}).then(res => {
            if (res.data == 0) {
              this.$notify.error({
                title: '错误',
                message: '撤销失败'
              });
            } else {
              this.$notify({
                title: '成功',
                message: '撤销成功',
                type: 'success'
              });
              this.ExamineDialog = false;
            }
          })
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消撤销'
          });
        })
      },

      refuseExamine(){
        this.$confirm('确定要拒绝审批吗?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning',
          center: true
        }).then(() => {
          axios.post("/refuseExamine",{"id":this.examineId,"userId":window.localStorage.getItem("id"),"enterpriseId":window.localStorage.getItem("enterprise_id")}).then(res => {
            if (res.data == 0) {
              this.$notify.error({
                title: '错误',
                message: '拒绝失败'
              });
            } else {
              this.$notify({
                title: '成功',
                message: '拒绝成功',
                type: 'success'
              });
              this.ExamineDialog = false;
            }
          })
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消拒绝'
          });
        })
      },

      noticeExamine(){
        this.$confirm('确定要提醒当前审批人吗?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning',
          center: true
        }).then(() => {
          axios.post("/noticeExamine",{"id":this.examineId,"userId":window.localStorage.getItem("id"),"getId":this.currentExamineId,"enterpriseId":window.localStorage.getItem("enterprise_id")}).then(res => {
            if (res.data == 0) {
              this.$notify.error({
                title: '错误',
                message: '提醒失败'
              });
            } else {
              this.$notify({
                title: '成功',
                message: '提醒成功',
                type: 'success'
              });
              this.ExamineDialog = false;
            }
          })
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消提醒'
          });
        })
      },

      deleteExamine(){
        this.$confirm('确定要删除审批吗?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning',
          center: true
        }).then(() => {
          axios.post("/deleteExamine",{"id":this.examineId}).then(res => {
            if (res.data == 0) {
              this.$notify.error({
                title: '错误',
                message: '删除失败'
              });
            } else {
              this.$notify({
                title: '成功',
                message: '删除成功',
                type: 'success'
              });
              this.ExamineDialog = false;
            }
          })
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消删除'
          });
        })
      },

      toConsole(){
        if(window.localStorage.getItem("level") < 2){
          this.$router.push('/console');
        }
      }
    }
  }
  </script>

  <style scoped>
    @import "../../assets/css/user.css";
  </style>

